[svn:parrot] r49645 - in branches/html_cleanup: . compilers/data_json compilers/imcc compilers/pct compilers/pct/src/PCT compilers/pct/src/POST compilers/pge compilers/pirc/src compilers/tge config/auto config/auto/ipv6 config/auto/sizes config/auto/stat config/auto/timespec config/auto/zlib config/gen config/gen/config_pm config/gen/makefiles config/gen/platform/darwin config/gen/platform/freebsd config/gen/platform/generic config/gen/platform/win32 config/init config/init/hints config/inter docs docs/book/draft docs/book/pct docs/dev docs/pdds docs/project examples/embed examples/languages/abc examples/languages/squaak examples/pge examples/tools ext/nqp-rx include/parrot include/parrot/oplib lib/Parrot lib/Parrot/Configure/Options lib/Parrot/Configure/Options/Conf lib/Parrot/Configure/Options/Test lib/Parrot/Configure/Step lib/Parrot/Pmc2c ports/cygwin ports/debian runtime/parrot/languages runtime/parrot/library runtime/parrot/library/Math src src/call src/dynpmc src/gc src/interp src/io src/ops src/pmc src/runcore src/string src/string/encoding t/codingstd t/compilers/imcc/syn t/compilers/tge t/configure t/examples t/library t/native_pbc t/oo t/op t/op/testlib t/pmc t/profiling t/src t/steps/auto t/steps/gen t/steps/init/hints t/steps/inter t/tools tools/build tools/dev tools/release
mikehh at svn.parrot.org
mikehh at svn.parrot.org
Sun Oct 24 12:14:38 UTC 2010
Author: mikehh
Date: Sun Oct 24 12:14:32 2010
New Revision: 49645
URL: https://trac.parrot.org/parrot/changeset/49645
Log:
[html_cleanup] merge latest trunk (r49644) into the branch
Added:
branches/html_cleanup/config/auto/ipv6/
- copied from r49644, trunk/config/auto/ipv6/
branches/html_cleanup/config/auto/ipv6.pm
- copied unchanged from r49644, trunk/config/auto/ipv6.pm
branches/html_cleanup/config/auto/stat/
- copied from r49644, trunk/config/auto/stat/
branches/html_cleanup/config/auto/stat.pm
- copied unchanged from r49644, trunk/config/auto/stat.pm
branches/html_cleanup/config/auto/timespec/
- copied from r49644, trunk/config/auto/timespec/
branches/html_cleanup/config/auto/timespec.pm
- copied unchanged from r49644, trunk/config/auto/timespec.pm
branches/html_cleanup/config/gen/platform/darwin/sysmem.c
- copied unchanged from r49644, trunk/config/gen/platform/darwin/sysmem.c
branches/html_cleanup/config/gen/platform/freebsd/
- copied from r49644, trunk/config/gen/platform/freebsd/
branches/html_cleanup/config/gen/platform/generic/sysmem.c
- copied unchanged from r49644, trunk/config/gen/platform/generic/sysmem.c
branches/html_cleanup/config/gen/platform/win32/sysmem.c
- copied unchanged from r49644, trunk/config/gen/platform/win32/sysmem.c
branches/html_cleanup/include/parrot/sysmem.h
- copied unchanged from r49644, trunk/include/parrot/sysmem.h
branches/html_cleanup/src/string/encoding/null.c
- copied unchanged from r49644, trunk/src/string/encoding/null.c
branches/html_cleanup/t/codingstd/c_enum.t
- copied unchanged from r49644, trunk/t/codingstd/c_enum.t
branches/html_cleanup/t/steps/auto/ipv6-01.t
- copied unchanged from r49644, trunk/t/steps/auto/ipv6-01.t
branches/html_cleanup/t/steps/auto/stat-01.t
- copied unchanged from r49644, trunk/t/steps/auto/stat-01.t
branches/html_cleanup/t/steps/auto/timespec-01.t
- copied unchanged from r49644, trunk/t/steps/auto/timespec-01.t
branches/html_cleanup/t/tools/create_language.t
- copied unchanged from r49644, trunk/t/tools/create_language.t
branches/html_cleanup/t/tools/mk_language_shell.t
- copied unchanged from r49644, trunk/t/tools/mk_language_shell.t
Replaced:
branches/html_cleanup/config/auto/ipv6/test.in
- copied unchanged from r49644, trunk/config/auto/ipv6/test.in
branches/html_cleanup/config/auto/stat/test_c.in
- copied unchanged from r49644, trunk/config/auto/stat/test_c.in
branches/html_cleanup/config/auto/timespec/test_c.in
- copied unchanged from r49644, trunk/config/auto/timespec/test_c.in
branches/html_cleanup/config/gen/platform/freebsd/sysmem.c
- copied unchanged from r49644, trunk/config/gen/platform/freebsd/sysmem.c
Deleted:
branches/html_cleanup/config/gen/platform/win32/stat.c
branches/html_cleanup/t/steps/gen/crypto-01.t
Modified:
branches/html_cleanup/ (props changed)
branches/html_cleanup/CREDITS
branches/html_cleanup/ChangeLog
branches/html_cleanup/Configure.pl
branches/html_cleanup/DEPRECATED.pod
branches/html_cleanup/MANIFEST
branches/html_cleanup/MANIFEST.generated
branches/html_cleanup/NEWS
branches/html_cleanup/PBC_COMPAT
branches/html_cleanup/README
branches/html_cleanup/VERSION
branches/html_cleanup/compilers/data_json/Rules.mak (props changed)
branches/html_cleanup/compilers/imcc/Rules.in (contents, props changed)
branches/html_cleanup/compilers/imcc/imc.h
branches/html_cleanup/compilers/imcc/imcc.l
branches/html_cleanup/compilers/imcc/imclexer.c
branches/html_cleanup/compilers/pct/Rules.mak (props changed)
branches/html_cleanup/compilers/pct/src/PCT/HLLCompiler.pir
branches/html_cleanup/compilers/pct/src/POST/Compiler.pir
branches/html_cleanup/compilers/pge/Rules.mak (props changed)
branches/html_cleanup/compilers/pirc/src/bcgen.c
branches/html_cleanup/compilers/tge/Rules.mak (props changed)
branches/html_cleanup/config/auto/sizes/intval_maxmin_c.in (props changed)
branches/html_cleanup/config/auto/zlib/ (props changed)
branches/html_cleanup/config/gen/config_pm/myconfig.in
branches/html_cleanup/config/gen/makefiles/root.in
branches/html_cleanup/config/gen/platform.pm
branches/html_cleanup/config/gen/platform/generic/stat.c
branches/html_cleanup/config/init/defaults.pm
branches/html_cleanup/config/init/hints/mswin32.pm
branches/html_cleanup/config/inter/progs.pm
branches/html_cleanup/docs/book/draft/README (props changed)
branches/html_cleanup/docs/book/draft/appa_glossary.pod (props changed)
branches/html_cleanup/docs/book/draft/appb_patch_submission.pod (props changed)
branches/html_cleanup/docs/book/draft/appc_command_line_options.pod (props changed)
branches/html_cleanup/docs/book/draft/appd_build_options.pod (props changed)
branches/html_cleanup/docs/book/draft/appe_source_code.pod (props changed)
branches/html_cleanup/docs/book/draft/ch01_introduction.pod (props changed)
branches/html_cleanup/docs/book/draft/ch02_getting_started.pod (props changed)
branches/html_cleanup/docs/book/draft/ch07_dynpmcs.pod (props changed)
branches/html_cleanup/docs/book/draft/ch08_dynops.pod (props changed)
branches/html_cleanup/docs/book/draft/ch10_opcode_reference.pod (props changed)
branches/html_cleanup/docs/book/draft/ch11_directive_reference.pod (props changed)
branches/html_cleanup/docs/book/draft/ch12_operator_reference.pod (props changed)
branches/html_cleanup/docs/book/draft/chXX_hlls.pod (props changed)
branches/html_cleanup/docs/book/draft/chXX_library.pod (props changed)
branches/html_cleanup/docs/book/draft/chXX_testing_and_debugging.pod (props changed)
branches/html_cleanup/docs/book/pct/ch01_introduction.pod (props changed)
branches/html_cleanup/docs/book/pct/ch02_getting_started.pod (props changed)
branches/html_cleanup/docs/book/pct/ch03_compiler_tools.pod (props changed)
branches/html_cleanup/docs/book/pct/ch04_pge.pod (props changed)
branches/html_cleanup/docs/book/pct/ch05_nqp.pod (props changed)
branches/html_cleanup/docs/dev/c_functions.pod (props changed)
branches/html_cleanup/docs/parrothist.pod
branches/html_cleanup/docs/pdds/pdd22_io.pod
branches/html_cleanup/docs/pdds/pdd28_strings.pod
branches/html_cleanup/docs/pdds/pdd30_install.pod (props changed)
branches/html_cleanup/docs/project/release_manager_guide.pod
branches/html_cleanup/examples/embed/cotorra.c (props changed)
branches/html_cleanup/examples/languages/abc/ (props changed)
branches/html_cleanup/examples/languages/squaak/ (props changed)
branches/html_cleanup/examples/pge/demo.pir (props changed)
branches/html_cleanup/examples/tools/pgegrep (props changed)
branches/html_cleanup/ext/nqp-rx/Rules.mak (props changed)
branches/html_cleanup/include/parrot/call.h (props changed)
branches/html_cleanup/include/parrot/encoding.h
branches/html_cleanup/include/parrot/extend.h
branches/html_cleanup/include/parrot/gc_api.h (props changed)
branches/html_cleanup/include/parrot/hash.h
branches/html_cleanup/include/parrot/imageio.h
branches/html_cleanup/include/parrot/list.h
branches/html_cleanup/include/parrot/memory.h
branches/html_cleanup/include/parrot/oplib/core_ops.h
branches/html_cleanup/include/parrot/oplib/ops.h
branches/html_cleanup/include/parrot/opsenum.h
branches/html_cleanup/include/parrot/runcore_api.h (contents, props changed)
branches/html_cleanup/include/parrot/runcore_profiling.h (contents, props changed)
branches/html_cleanup/include/parrot/runcore_trace.h (props changed)
branches/html_cleanup/include/parrot/string.h
branches/html_cleanup/include/parrot/string_funcs.h
branches/html_cleanup/include/parrot/thr_windows.h
branches/html_cleanup/include/parrot/thread.h
branches/html_cleanup/lib/Parrot/Configure/Options/Conf.pm
branches/html_cleanup/lib/Parrot/Configure/Options/Conf/Shared.pm
branches/html_cleanup/lib/Parrot/Configure/Options/Test.pm
branches/html_cleanup/lib/Parrot/Configure/Options/Test/Prepare.pm
branches/html_cleanup/lib/Parrot/Configure/Step/List.pm
branches/html_cleanup/lib/Parrot/Configure/Step/Test.pm (props changed)
branches/html_cleanup/lib/Parrot/H2inc.pm (props changed)
branches/html_cleanup/lib/Parrot/Pmc2c/PMC.pm
branches/html_cleanup/ports/cygwin/parrot-1.0.0-1.cygport (props changed)
branches/html_cleanup/ports/debian/libparrot-dev.install.in (props changed)
branches/html_cleanup/ports/debian/libparrot.install.in (props changed)
branches/html_cleanup/ports/debian/parrot-devel.install.in
branches/html_cleanup/ports/debian/parrot-doc.install.in (props changed)
branches/html_cleanup/ports/debian/parrot.install.in (props changed)
branches/html_cleanup/runtime/parrot/languages/ (props changed)
branches/html_cleanup/runtime/parrot/library/Math/Rand.pir (props changed)
branches/html_cleanup/runtime/parrot/library/Rules.mak (props changed)
branches/html_cleanup/src/call/ops.c (props changed)
branches/html_cleanup/src/call/pcc.c (contents, props changed)
branches/html_cleanup/src/debug.c
branches/html_cleanup/src/dynext.c
branches/html_cleanup/src/dynpmc/os.pmc
branches/html_cleanup/src/embed.c
branches/html_cleanup/src/exceptions.c
branches/html_cleanup/src/extend.c
branches/html_cleanup/src/gc/alloc_memory.c (contents, props changed)
branches/html_cleanup/src/gc/alloc_resources.c (props changed)
branches/html_cleanup/src/gc/api.c (props changed)
branches/html_cleanup/src/gc/gc_inf.c
branches/html_cleanup/src/gc/gc_ms.c
branches/html_cleanup/src/gc/gc_ms2.c
branches/html_cleanup/src/gc/malloc.c (props changed)
branches/html_cleanup/src/gc/malloc_trace.c (props changed)
branches/html_cleanup/src/gc/mark_sweep.c (props changed)
branches/html_cleanup/src/gc/string_gc.c (props changed)
branches/html_cleanup/src/gc/system.c (props changed)
branches/html_cleanup/src/hash.c
branches/html_cleanup/src/hll.c
branches/html_cleanup/src/interp/inter_cb.c (props changed)
branches/html_cleanup/src/interp/inter_create.c (contents, props changed)
branches/html_cleanup/src/interp/inter_misc.c (props changed)
branches/html_cleanup/src/io/api.c
branches/html_cleanup/src/io/buffer.c
branches/html_cleanup/src/io/filehandle.c
branches/html_cleanup/src/library.c
branches/html_cleanup/src/list.c
branches/html_cleanup/src/multidispatch.c
branches/html_cleanup/src/oo.c
branches/html_cleanup/src/ops/cmp.ops
branches/html_cleanup/src/ops/core.ops
branches/html_cleanup/src/ops/core_ops.c
branches/html_cleanup/src/ops/string.ops
branches/html_cleanup/src/packdump.c
branches/html_cleanup/src/packfile.c
branches/html_cleanup/src/packout.c
branches/html_cleanup/src/pmc.c
branches/html_cleanup/src/pmc/addrregistry.pmc
branches/html_cleanup/src/pmc/bytebuffer.pmc
branches/html_cleanup/src/pmc/callcontext.pmc
branches/html_cleanup/src/pmc/class.pmc
branches/html_cleanup/src/pmc/codestring.pmc
branches/html_cleanup/src/pmc/complex.pmc
branches/html_cleanup/src/pmc/default.pmc
branches/html_cleanup/src/pmc/eventhandler.pmc
branches/html_cleanup/src/pmc/exception.pmc
branches/html_cleanup/src/pmc/filehandle.pmc
branches/html_cleanup/src/pmc/fixedbooleanarray.pmc
branches/html_cleanup/src/pmc/fixedstringarray.pmc
branches/html_cleanup/src/pmc/lexinfo.pmc
branches/html_cleanup/src/pmc/namespace.pmc
branches/html_cleanup/src/pmc/nci.pmc
branches/html_cleanup/src/pmc/object.pmc
branches/html_cleanup/src/pmc/packfile.pmc
branches/html_cleanup/src/pmc/packfileconstanttable.pmc
branches/html_cleanup/src/pmc/parrotinterpreter.pmc
branches/html_cleanup/src/pmc/pmcproxy.pmc
branches/html_cleanup/src/pmc/role.pmc
branches/html_cleanup/src/pmc/scalar.pmc
branches/html_cleanup/src/pmc/scheduler.pmc
branches/html_cleanup/src/pmc/socket.pmc
branches/html_cleanup/src/pmc/string.pmc
branches/html_cleanup/src/pmc/stringbuilder.pmc
branches/html_cleanup/src/pmc/stringhandle.pmc
branches/html_cleanup/src/pmc/sub.pmc
branches/html_cleanup/src/pmc/task.pmc
branches/html_cleanup/src/runcore/cores.c (props changed)
branches/html_cleanup/src/runcore/main.c (contents, props changed)
branches/html_cleanup/src/runcore/profiling.c (contents, props changed)
branches/html_cleanup/src/runcore/trace.c (contents, props changed)
branches/html_cleanup/src/scheduler.c
branches/html_cleanup/src/spf_render.c
branches/html_cleanup/src/spf_vtable.c
branches/html_cleanup/src/string/api.c
branches/html_cleanup/src/string/encoding.c
branches/html_cleanup/src/string/encoding/ascii.c
branches/html_cleanup/src/string/encoding/binary.c
branches/html_cleanup/src/string/encoding/latin1.c
branches/html_cleanup/src/string/encoding/shared.c
branches/html_cleanup/src/string/encoding/shared.h
branches/html_cleanup/src/string/encoding/ucs2.c
branches/html_cleanup/src/string/encoding/ucs4.c
branches/html_cleanup/src/string/encoding/utf16.c
branches/html_cleanup/src/string/encoding/utf8.c
branches/html_cleanup/src/sub.c
branches/html_cleanup/src/warnings.c
branches/html_cleanup/t/codingstd/pmc_docs.t (props changed)
branches/html_cleanup/t/compilers/imcc/syn/objects.t
branches/html_cleanup/t/compilers/imcc/syn/pcc.t
branches/html_cleanup/t/compilers/imcc/syn/regressions.t
branches/html_cleanup/t/compilers/imcc/syn/subflags.t
branches/html_cleanup/t/compilers/tge/NoneGrammar.tg (props changed)
branches/html_cleanup/t/configure/049-options_test_prepare.t
branches/html_cleanup/t/examples/pgegrep.t (props changed)
branches/html_cleanup/t/library/string_utils.t
branches/html_cleanup/t/native_pbc/integer.pbc
branches/html_cleanup/t/native_pbc/number.pbc
branches/html_cleanup/t/native_pbc/string.pbc
branches/html_cleanup/t/oo/objects.t (props changed)
branches/html_cleanup/t/oo/root_new.t (props changed)
branches/html_cleanup/t/op/gc-non-recursive.t
branches/html_cleanup/t/op/gc.t
branches/html_cleanup/t/op/string.t
branches/html_cleanup/t/op/string_cclass.t
branches/html_cleanup/t/op/string_cs.t
branches/html_cleanup/t/op/stringu.t
branches/html_cleanup/t/op/testlib/test_strings.pir
branches/html_cleanup/t/pmc/boolean.t
branches/html_cleanup/t/pmc/bytebuffer.t
branches/html_cleanup/t/pmc/fixedpmcarray.t
branches/html_cleanup/t/pmc/hash.t
branches/html_cleanup/t/pmc/lexpad.t
branches/html_cleanup/t/pmc/multidispatch.t
branches/html_cleanup/t/pmc/namespace-old.t (props changed)
branches/html_cleanup/t/pmc/namespace.t
branches/html_cleanup/t/pmc/sockaddr.t
branches/html_cleanup/t/pmc/socket.t
branches/html_cleanup/t/pmc/string.t
branches/html_cleanup/t/pmc/stringbuilder.t
branches/html_cleanup/t/pmc/sub.t
branches/html_cleanup/t/profiling/profiling.t
branches/html_cleanup/t/src/embed.t (props changed)
branches/html_cleanup/t/steps/auto/format-01.t
branches/html_cleanup/t/steps/auto/llvm-01.t
branches/html_cleanup/t/steps/init/hints/linux-01.t (props changed)
branches/html_cleanup/t/steps/inter/progs-01.t
branches/html_cleanup/t/steps/inter/progs-02.t
branches/html_cleanup/t/steps/inter/progs-03.t
branches/html_cleanup/t/steps/inter/progs-04.t
branches/html_cleanup/t/tools/pbc_disassemble.t
branches/html_cleanup/t/tools/pbc_dump.t
branches/html_cleanup/tools/build/README (props changed)
branches/html_cleanup/tools/build/h2inc.pl (props changed)
branches/html_cleanup/tools/dev/README (props changed)
branches/html_cleanup/tools/dev/addopstags.pl (props changed)
branches/html_cleanup/tools/dev/dump_pbc.pl (props changed)
branches/html_cleanup/tools/dev/fetch_languages.pl (props changed)
branches/html_cleanup/tools/dev/headerizer.pl (props changed)
branches/html_cleanup/tools/dev/mk_gitignore.pl (props changed)
branches/html_cleanup/tools/dev/ncidef2pasm.pl (props changed)
branches/html_cleanup/tools/dev/parrot-config.pir (props changed)
branches/html_cleanup/tools/dev/perlcritic-cage.conf (props changed)
branches/html_cleanup/tools/dev/perlcritic.conf (props changed)
branches/html_cleanup/tools/dev/perltidy.conf (props changed)
branches/html_cleanup/tools/dev/update_copyright.pl (props changed)
branches/html_cleanup/tools/release/crow.pir (props changed)
branches/html_cleanup/tools/release/gen_release_info.pl (props changed)
branches/html_cleanup/tools/release/inc_ver.pir (props changed)
branches/html_cleanup/tools/release/release.json (contents, props changed)
branches/html_cleanup/tools/release/templates.json (contents, props changed)
Modified: branches/html_cleanup/CREDITS
==============================================================================
--- branches/html_cleanup/CREDITS Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/CREDITS Sun Oct 24 12:14:32 2010 (r49645)
@@ -400,9 +400,15 @@
N: Gerard Goossen
D: Documentation patch for Parrot_PMC_get_pointer_intkey()
+N: Géraud Continsouzas
+U: GeJ
+A: geraud
+D: Perl2Pir tests conversion
+D: Miscellaneous codingstd fixes
+
N: Gerd Pokorra
E: pokorra at uni-siegen.de
-D: Release manager for 1.9.0, 2.3.0, 2.5.0 and 2.8.0
+D: Release manager for 1.9.0, 2.3.0, 2.5.0, 2.8.0 and 2.9.0
N: Goplat
D: Win98 and other fixes.
@@ -450,7 +456,7 @@
N: isop
D: various Pynie patches
-N: James E Keenan (Jim)
+N: James E Keenan (Jim) (aka kid51)
E: jkeenan at cpan.org
U: jkeenan
D: Testing of configuration and build tools
Modified: branches/html_cleanup/ChangeLog
==============================================================================
--- branches/html_cleanup/ChangeLog Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/ChangeLog Sun Oct 24 12:14:32 2010 (r49645)
@@ -1,5 +1,9 @@
#1 $Id$
+2010.10.19 Gerd
+ * Released 2.9.0
+ See NEWS for more.
+
2010.09.21 Gerd
* Released 2.8.0
See NEWS for more.
Modified: branches/html_cleanup/Configure.pl
==============================================================================
--- branches/html_cleanup/Configure.pl Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/Configure.pl Sun Oct 24 12:14:32 2010 (r49645)
@@ -285,6 +285,14 @@
Use the given linker flags
+=item C<--ar=(archiver)>
+
+Specify which librarian to use for static libraries
+
+=item C<--arflags=(flags)>
+
+Use the given librarian flags for static libraris
+
=item C<--ld=(linker)>
Specify which loader to use for shared libraries.
Modified: branches/html_cleanup/DEPRECATED.pod
==============================================================================
--- branches/html_cleanup/DEPRECATED.pod Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/DEPRECATED.pod Sun Oct 24 12:14:32 2010 (r49645)
@@ -143,14 +143,6 @@
L<https://trac.parrot.org/parrot/ticket/1564>
-=item Behavior of Parrot::Pmc2c::PMC::add_method() [eligible in 2.10]
-
-Duplicated vtable functions currently generate only a warning; after deadline,
-they will cause a C<die> and failure to build Parrot or any HLL
-using this method.
-
-L<http://trac.parrot.org/parrot/ticket/1785>
-
=back
=head1 Opcodes
Modified: branches/html_cleanup/MANIFEST
==============================================================================
--- branches/html_cleanup/MANIFEST Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/MANIFEST Sun Oct 24 12:14:32 2010 (r49645)
@@ -211,6 +211,8 @@
config/auto/inline.pm []
config/auto/inline/test1_c.in []
config/auto/inline/test2_c.in []
+config/auto/ipv6.pm []
+config/auto/ipv6/test.in []
config/auto/isreg.pm []
config/auto/isreg/test_c.in []
config/auto/jit.pm []
@@ -247,7 +249,11 @@
config/auto/snprintf.pm []
config/auto/snprintf/test_c.in []
config/auto/socklen_t.pm []
+config/auto/stat.pm []
+config/auto/stat/test_c.in []
config/auto/thread.pm []
+config/auto/timespec.pm []
+config/auto/timespec/test_c.in []
config/auto/va_ptr.pm []
config/auto/va_ptr/test_c.in []
config/auto/warnings.pm []
@@ -282,6 +288,8 @@
config/gen/platform/cygwin/math.c []
config/gen/platform/darwin/begin.c []
config/gen/platform/darwin/hires_timer.c []
+config/gen/platform/darwin/sysmem.c []
+config/gen/platform/freebsd/sysmem.c []
config/gen/platform/generic/dl.c []
config/gen/platform/generic/dl.h []
config/gen/platform/generic/env.c []
@@ -298,6 +306,7 @@
config/gen/platform/generic/signal.h []
config/gen/platform/generic/stat.c []
config/gen/platform/generic/stat.h []
+config/gen/platform/generic/sysmem.c []
config/gen/platform/generic/threads.h []
config/gen/platform/generic/time.c []
config/gen/platform/ia64/asm.s []
@@ -320,9 +329,9 @@
config/gen/platform/win32/pid.c []
config/gen/platform/win32/signal.c []
config/gen/platform/win32/signal.h []
-config/gen/platform/win32/stat.c []
config/gen/platform/win32/stat.h []
config/gen/platform/win32/string.h []
+config/gen/platform/win32/sysmem.c []
config/gen/platform/win32/threads.h []
config/gen/platform/win32/time.c []
config/init/defaults.pm []
@@ -1009,6 +1018,7 @@
include/parrot/string_funcs.h [main]include
include/parrot/string_primitives.h [main]include
include/parrot/sub.h [main]include
+include/parrot/sysmem.h [main]include
include/parrot/thr_pthread.h [main]include
include/parrot/thr_windows.h [main]include
include/parrot/thread.h [main]include
@@ -1462,6 +1472,7 @@
src/string/encoding/ascii.c []
src/string/encoding/binary.c []
src/string/encoding/latin1.c []
+src/string/encoding/null.c []
src/string/encoding/shared.c []
src/string/encoding/shared.h []
src/string/encoding/tables.c []
@@ -1484,6 +1495,7 @@
t/codingstd/c_arg_assert.t [test]
t/codingstd/c_code_coda.t [test]
t/codingstd/c_cppcomments.t [test]
+t/codingstd/c_enum.t [test]
t/codingstd/c_function_docs.t [test]
t/codingstd/c_header_guards.t [test]
t/codingstd/c_indent.t [test]
@@ -1991,6 +2003,7 @@
t/steps/auto/headers-01.t [test]
t/steps/auto/icu-01.t [test]
t/steps/auto/inline-01.t [test]
+t/steps/auto/ipv6-01.t [test]
t/steps/auto/isreg-01.t [test]
t/steps/auto/jit-01.t [test]
t/steps/auto/llvm-01.t [test]
@@ -2010,14 +2023,15 @@
t/steps/auto/sizes-01.t [test]
t/steps/auto/snprintf-01.t [test]
t/steps/auto/socklen_t-01.t [test]
+t/steps/auto/stat-01.t [test]
t/steps/auto/thread-01.t [test]
+t/steps/auto/timespec-01.t [test]
t/steps/auto/va_ptr-01.t [test]
t/steps/auto/warnings-01.t [test]
t/steps/auto/zlib-01.t [test]
t/steps/gen/config_h-01.t [test]
t/steps/gen/config_pm-01.t [test]
t/steps/gen/core_pmcs-01.t [test]
-t/steps/gen/crypto-01.t [test]
t/steps/gen/makefiles-01.t [test]
t/steps/gen/opengl-01.t [test]
t/steps/gen/platform-01.t [test]
@@ -2043,6 +2057,7 @@
t/steps/inter/yacc-01.t [test]
t/steps/inter/yacc-02.t [test]
t/stress/gc.t [test]
+t/tools/create_language.t [test]
t/tools/dev/pmctree.t [test]
t/tools/dev/searchops.t [test]
t/tools/dev/searchops/samples.pm [test]
@@ -2078,6 +2093,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/mk_language_shell.t [test]
t/tools/parrot_config.t [test]
t/tools/parrot_debugger.t [test]
t/tools/pbc_disassemble.t [test]
Modified: branches/html_cleanup/MANIFEST.generated
==============================================================================
--- branches/html_cleanup/MANIFEST.generated Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/MANIFEST.generated Sun Oct 24 12:14:32 2010 (r49645)
@@ -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.8.0.dylib [main]lib
+blib/lib/libparrot.2.9.1.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.8.0 [main]lib
+blib/lib/libparrot.so.2.9.1 [main]lib
compilers/data_json/data_json.pbc [data_json]
config/gen/call_list/opengl.in []
docs/ops/bit.pod [doc]
Modified: branches/html_cleanup/NEWS
==============================================================================
--- branches/html_cleanup/NEWS Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/NEWS Sun Oct 24 12:14:32 2010 (r49645)
@@ -1,12 +1,29 @@
# $Id$
+New in 2.9.1
+ - This is a bugfix release. If you run out of memory on a box with < 512 MB physical RAM, please report it to us.
+
New in 2.9.0
- Core
- + New default garbage collector
+ + Parrot and Rakudo's build and tests can now be run under the profiling runcore
+ + IPv6 is now detected, laying the groundwork for future networking improvements
+ + mk_language_shell.pl and create_language.pl no longer require an installed parrot
+ + String PMC's 'reverse' method is now faster and supports all encodings
+ + improvements and simplifications in internal string processing
+ + Added API for adding STRINGs to the gc root set
+ + Speed up ord, substr, index and string comparison opcodes
- Testing
- + "make smoke" now respects TEST_JOBS
-- GitMigration
-- Compilers
+ + "make smoke" supports parallel testing by honoring TEST_JOBS
+ + Added tests for Socket PMC, StringBuilder PMC, ByteBuffer PMC,
+ mk_language_shell.pl, create_language.pl
+ + Fixed "Configure.pl" about missing tests
+ + Parrot and Rakudo Perl 6 now have access to the GCC Compile Farm
+ + Testing on Darwin/PPC
+- Git Migration
+ + Most developer tools have been ported to Git
+ + Majority of developer docs have been written for Git
+- Platforms
+ + Parrot can now be built on Minix
New in 2.8.0
- Core
Modified: branches/html_cleanup/PBC_COMPAT
==============================================================================
--- branches/html_cleanup/PBC_COMPAT Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/PBC_COMPAT Sun Oct 24 12:14:32 2010 (r49645)
@@ -28,11 +28,7 @@
# please insert tab separated entries at the top of the list
-8.5 2010.08.24 plobsing eliminate fixup table
-8.4 2010.09.19 cotto add imageiothaw and imageiofreeze PMCs (plobsing)
-8.3 2010.09.15 luben removed logical vtables
-8.2 2010.08.19 cotto minor version bump for 2.7.0
-8.1 2010.08.10 plobsing merge dynop_mapping branch
+9.0 2010.10.19 gerd released 2.9.0
8.0 2010.07.20 coke released 2.6.0
7.0 2010.04.20 gerd released 2.3.0 (version # added ex post facto, as all previous version #s were published)
6.6 2010.04.17 bacek add replace op
Modified: branches/html_cleanup/README
==============================================================================
--- branches/html_cleanup/README Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/README Sun Oct 24 12:14:32 2010 (r49645)
@@ -1,4 +1,4 @@
-This is Parrot, version 2.8.0
+This is Parrot, version 2.9.1
------------------------------
Parrot is Copyright (C) 2001-2010, Parrot Foundation.
Modified: branches/html_cleanup/VERSION
==============================================================================
--- branches/html_cleanup/VERSION Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/VERSION Sun Oct 24 12:14:32 2010 (r49645)
@@ -1 +1 @@
-2.8.0
+2.9.1
Modified: branches/html_cleanup/compilers/imcc/Rules.in
==============================================================================
--- branches/html_cleanup/compilers/imcc/Rules.in Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/compilers/imcc/Rules.in Sun Oct 24 12:14:32 2010 (r49645)
@@ -44,6 +44,7 @@
$(INC_DIR)/oplib/core_ops.h \
$(INC_DIR)/runcore_api.h \
$(PARROT_H_HEADERS) \
+ include/pmc/pmc_key.h \
include/pmc/pmc_sub.h
compilers/imcc/parser_util$(O) : \
Modified: branches/html_cleanup/compilers/imcc/imc.h
==============================================================================
--- branches/html_cleanup/compilers/imcc/imc.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/compilers/imcc/imc.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -59,7 +59,7 @@
enum {
IMCC_FATAL_EXCEPTION = 1,
IMCC_FATALY_EXCEPTION = 2,
- IMCC_PARSEFAIL_EXCEPTION = 3,
+ IMCC_PARSEFAIL_EXCEPTION = 3
};
#define N_ELEMENTS(x) (sizeof (x)/sizeof ((x)[0]))
Modified: branches/html_cleanup/compilers/imcc/imcc.l
==============================================================================
--- branches/html_cleanup/compilers/imcc/imcc.l Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/compilers/imcc/imcc.l Sun Oct 24 12:14:32 2010 (r49645)
@@ -17,6 +17,9 @@
# define __STDC_VERSION__ 0
#endif
+#include "imc.h"
+#include "parser.h"
+
}
%{
@@ -34,13 +37,6 @@
*
*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "imc.h"
-#include "parser.h"
-
typedef struct parser_state_t parser_state_t;
/* parser state structure
Modified: branches/html_cleanup/compilers/imcc/imclexer.c
==============================================================================
--- branches/html_cleanup/compilers/imcc/imclexer.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/compilers/imcc/imclexer.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -18,10 +18,13 @@
# define __STDC_VERSION__ 0
#endif
+#include "imc.h"
+#include "parser.h"
-#line 25 "compilers/imcc/imclexer.c"
+
+#line 28 "compilers/imcc/imclexer.c"
#define YY_INT_ALIGNED short int
@@ -75,6 +78,7 @@
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -105,8 +109,6 @@
#define UINT32_MAX (4294967295U)
#endif
-#endif /* ! C99 */
-
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -180,15 +182,7 @@
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
@@ -2423,7 +2417,7 @@
#define YY_RESTORE_YY_MORE_OFFSET
#line 1 "compilers/imcc/imcc.l"
-#line 23 "compilers/imcc/imcc.l"
+#line 26 "compilers/imcc/imcc.l"
/*
* imcc.l
*
@@ -2438,13 +2432,6 @@
*
*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "imc.h"
-#include "parser.h"
-
typedef struct parser_state_t parser_state_t;
/* parser state structure
@@ -2523,7 +2510,7 @@
-#line 2527 "compilers/imcc/imclexer.c"
+#line 2514 "compilers/imcc/imclexer.c"
#define INITIAL 0
#define emit 1
@@ -2658,12 +2645,7 @@
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
@@ -2671,7 +2653,7 @@
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -2682,7 +2664,7 @@
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- size_t n; \
+ int n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -2768,7 +2750,7 @@
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 154 "compilers/imcc/imcc.l"
+#line 150 "compilers/imcc/imcc.l"
/* for emacs "*/
if (IMCC_INFO(interp)->expect_pasm == 1 && !IMCC_INFO(interp)->in_pod) {
@@ -2787,7 +2769,7 @@
return 0;
}
-#line 2791 "compilers/imcc/imclexer.c"
+#line 2773 "compilers/imcc/imclexer.c"
if ( !yyg->yy_init )
{
@@ -2881,13 +2863,13 @@
case 1:
YY_RULE_SETUP
-#line 172 "compilers/imcc/imcc.l"
+#line 168 "compilers/imcc/imcc.l"
{ SET_LINE_NUMBER; }
YY_BREAK
case 2:
/* rule 2 can match eol */
YY_RULE_SETUP
-#line 174 "compilers/imcc/imcc.l"
+#line 170 "compilers/imcc/imcc.l"
{
SET_LINE_NUMBER;
IMCC_INFO(interp)->frames->heredoc_rest = mem_sys_strdup(yytext);
@@ -2897,7 +2879,7 @@
case 3:
/* rule 3 can match eol */
YY_RULE_SETUP
-#line 180 "compilers/imcc/imcc.l"
+#line 176 "compilers/imcc/imcc.l"
{
/* heredocs have highest priority
* arrange them before all wildcard state matches */
@@ -2913,7 +2895,7 @@
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 193 "compilers/imcc/imcc.l"
+#line 189 "compilers/imcc/imcc.l"
{
SET_LINE_NUMBER;
/* Are we at the end of the heredoc? */
@@ -2954,7 +2936,7 @@
case 5:
/* rule 5 can match eol */
YY_RULE_SETUP
-#line 230 "compilers/imcc/imcc.l"
+#line 226 "compilers/imcc/imcc.l"
{
yy_pop_state(yyscanner);
yy_push_state(cmt3, yyscanner);
@@ -2967,7 +2949,7 @@
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 240 "compilers/imcc/imcc.l"
+#line 236 "compilers/imcc/imcc.l"
{
yy_pop_state(yyscanner);
yy_push_state(cmt4, yyscanner);
@@ -2975,17 +2957,17 @@
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 245 "compilers/imcc/imcc.l"
+#line 241 "compilers/imcc/imcc.l"
{ yy_push_state(cmt2, yyscanner); }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 247 "compilers/imcc/imcc.l"
+#line 243 "compilers/imcc/imcc.l"
{ yy_push_state(cmt1, yyscanner); }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 249 "compilers/imcc/imcc.l"
+#line 245 "compilers/imcc/imcc.l"
{
yylineno = IMCC_INFO(interp)->line = atoi(yytext);
yy_pop_state(yyscanner);
@@ -2996,7 +2978,7 @@
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
-#line 256 "compilers/imcc/imcc.l"
+#line 252 "compilers/imcc/imcc.l"
{
yy_pop_state(yyscanner);
}
@@ -3004,7 +2986,7 @@
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
-#line 260 "compilers/imcc/imcc.l"
+#line 256 "compilers/imcc/imcc.l"
{
if (IMCC_INFO(interp)->expect_pasm == 2)
BEGIN(INITIAL);
@@ -3016,7 +2998,7 @@
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 269 "compilers/imcc/imcc.l"
+#line 265 "compilers/imcc/imcc.l"
{
yy_push_state(cmt5, yyscanner);
}
@@ -3024,7 +3006,7 @@
case 13:
/* rule 13 can match eol */
YY_RULE_SETUP
-#line 273 "compilers/imcc/imcc.l"
+#line 269 "compilers/imcc/imcc.l"
{
if (IMCC_INFO(interp)->expect_pasm == 2)
BEGIN(INITIAL);
@@ -3039,7 +3021,7 @@
case 14:
/* rule 14 can match eol */
YY_RULE_SETUP
-#line 285 "compilers/imcc/imcc.l"
+#line 281 "compilers/imcc/imcc.l"
{
/* this is a stand-alone =cut, but we're not in POD mode, so ignore. */
SET_LINE_NUMBER;
@@ -3048,7 +3030,7 @@
case 15:
/* rule 15 can match eol */
YY_RULE_SETUP
-#line 290 "compilers/imcc/imcc.l"
+#line 286 "compilers/imcc/imcc.l"
{
SET_LINE_NUMBER;
IMCC_INFO(interp)->in_pod = 1;
@@ -3058,7 +3040,7 @@
case 16:
/* rule 16 can match eol */
YY_RULE_SETUP
-#line 296 "compilers/imcc/imcc.l"
+#line 292 "compilers/imcc/imcc.l"
{
SET_LINE_NUMBER;
IMCC_INFO(interp)->in_pod = 0;
@@ -3067,478 +3049,478 @@
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 302 "compilers/imcc/imcc.l"
+#line 298 "compilers/imcc/imcc.l"
{ SET_LINE_NUMBER; }
YY_BREAK
case 18:
/* rule 18 can match eol */
YY_RULE_SETUP
-#line 304 "compilers/imcc/imcc.l"
+#line 300 "compilers/imcc/imcc.l"
{ /* ignore */ }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 306 "compilers/imcc/imcc.l"
+#line 302 "compilers/imcc/imcc.l"
return TK_LINE;
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 307 "compilers/imcc/imcc.l"
+#line 303 "compilers/imcc/imcc.l"
return TK_FILE;
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 308 "compilers/imcc/imcc.l"
+#line 304 "compilers/imcc/imcc.l"
return ANNOTATE;
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 309 "compilers/imcc/imcc.l"
+#line 305 "compilers/imcc/imcc.l"
return LEXICAL;
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 310 "compilers/imcc/imcc.l"
+#line 306 "compilers/imcc/imcc.l"
return ARG;
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 311 "compilers/imcc/imcc.l"
+#line 307 "compilers/imcc/imcc.l"
return SUB;
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 312 "compilers/imcc/imcc.l"
+#line 308 "compilers/imcc/imcc.l"
return ESUB;
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 313 "compilers/imcc/imcc.l"
+#line 309 "compilers/imcc/imcc.l"
return PCC_BEGIN;
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 314 "compilers/imcc/imcc.l"
+#line 310 "compilers/imcc/imcc.l"
return PCC_END;
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 315 "compilers/imcc/imcc.l"
+#line 311 "compilers/imcc/imcc.l"
return PCC_CALL;
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 316 "compilers/imcc/imcc.l"
+#line 312 "compilers/imcc/imcc.l"
return NCI_CALL;
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 317 "compilers/imcc/imcc.l"
+#line 313 "compilers/imcc/imcc.l"
return METH_CALL;
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 318 "compilers/imcc/imcc.l"
+#line 314 "compilers/imcc/imcc.l"
return INVOCANT;
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 319 "compilers/imcc/imcc.l"
+#line 315 "compilers/imcc/imcc.l"
return PCC_SUB;
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 320 "compilers/imcc/imcc.l"
+#line 316 "compilers/imcc/imcc.l"
return PCC_BEGIN_RETURN;
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 321 "compilers/imcc/imcc.l"
+#line 317 "compilers/imcc/imcc.l"
return PCC_END_RETURN;
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 322 "compilers/imcc/imcc.l"
+#line 318 "compilers/imcc/imcc.l"
return PCC_BEGIN_YIELD;
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 323 "compilers/imcc/imcc.l"
+#line 319 "compilers/imcc/imcc.l"
return PCC_END_YIELD;
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 325 "compilers/imcc/imcc.l"
+#line 321 "compilers/imcc/imcc.l"
return METHOD;
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 326 "compilers/imcc/imcc.l"
+#line 322 "compilers/imcc/imcc.l"
return MULTI;
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 327 "compilers/imcc/imcc.l"
+#line 323 "compilers/imcc/imcc.l"
return MAIN;
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 328 "compilers/imcc/imcc.l"
+#line 324 "compilers/imcc/imcc.l"
return LOAD;
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 329 "compilers/imcc/imcc.l"
+#line 325 "compilers/imcc/imcc.l"
return INIT;
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 330 "compilers/imcc/imcc.l"
+#line 326 "compilers/imcc/imcc.l"
return IMMEDIATE;
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 331 "compilers/imcc/imcc.l"
+#line 327 "compilers/imcc/imcc.l"
return POSTCOMP;
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 332 "compilers/imcc/imcc.l"
+#line 328 "compilers/imcc/imcc.l"
return ANON;
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 333 "compilers/imcc/imcc.l"
+#line 329 "compilers/imcc/imcc.l"
return OUTER;
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 334 "compilers/imcc/imcc.l"
+#line 330 "compilers/imcc/imcc.l"
return NEED_LEX;
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 335 "compilers/imcc/imcc.l"
+#line 331 "compilers/imcc/imcc.l"
return VTABLE_METHOD;
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 336 "compilers/imcc/imcc.l"
+#line 332 "compilers/imcc/imcc.l"
return NS_ENTRY;
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 337 "compilers/imcc/imcc.l"
+#line 333 "compilers/imcc/imcc.l"
return UNIQUE_REG;
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 338 "compilers/imcc/imcc.l"
+#line 334 "compilers/imcc/imcc.l"
return SUB_INSTANCE_OF;
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 339 "compilers/imcc/imcc.l"
+#line 335 "compilers/imcc/imcc.l"
return SUBID;
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 341 "compilers/imcc/imcc.l"
+#line 337 "compilers/imcc/imcc.l"
return RESULT;
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 342 "compilers/imcc/imcc.l"
+#line 338 "compilers/imcc/imcc.l"
return GET_RESULTS;
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 343 "compilers/imcc/imcc.l"
+#line 339 "compilers/imcc/imcc.l"
return YIELDT;
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 344 "compilers/imcc/imcc.l"
+#line 340 "compilers/imcc/imcc.l"
return SET_YIELD;
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 345 "compilers/imcc/imcc.l"
+#line 341 "compilers/imcc/imcc.l"
return RETURN;
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 346 "compilers/imcc/imcc.l"
+#line 342 "compilers/imcc/imcc.l"
return SET_RETURN;
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 347 "compilers/imcc/imcc.l"
+#line 343 "compilers/imcc/imcc.l"
return TAILCALL;
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 348 "compilers/imcc/imcc.l"
+#line 344 "compilers/imcc/imcc.l"
return LOADLIB;
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 350 "compilers/imcc/imcc.l"
+#line 346 "compilers/imcc/imcc.l"
return ADV_FLAT;
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 351 "compilers/imcc/imcc.l"
+#line 347 "compilers/imcc/imcc.l"
return ADV_SLURPY;
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 352 "compilers/imcc/imcc.l"
+#line 348 "compilers/imcc/imcc.l"
return ADV_OPTIONAL;
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 353 "compilers/imcc/imcc.l"
+#line 349 "compilers/imcc/imcc.l"
return ADV_OPT_FLAG;
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 354 "compilers/imcc/imcc.l"
+#line 350 "compilers/imcc/imcc.l"
return ADV_NAMED;
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 355 "compilers/imcc/imcc.l"
+#line 351 "compilers/imcc/imcc.l"
return ADV_ARROW;
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 356 "compilers/imcc/imcc.l"
+#line 352 "compilers/imcc/imcc.l"
return ADV_INVOCANT;
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 357 "compilers/imcc/imcc.l"
+#line 353 "compilers/imcc/imcc.l"
return ADV_CALL_SIG;
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 359 "compilers/imcc/imcc.l"
+#line 355 "compilers/imcc/imcc.l"
return NAMESPACE;
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 360 "compilers/imcc/imcc.l"
+#line 356 "compilers/imcc/imcc.l"
return HLL;
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 362 "compilers/imcc/imcc.l"
+#line 358 "compilers/imcc/imcc.l"
return LOCAL;
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 363 "compilers/imcc/imcc.l"
+#line 359 "compilers/imcc/imcc.l"
return CONST;
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 364 "compilers/imcc/imcc.l"
+#line 360 "compilers/imcc/imcc.l"
return GLOBAL_CONST;
YY_BREAK
case 73:
YY_RULE_SETUP
-#line 365 "compilers/imcc/imcc.l"
+#line 361 "compilers/imcc/imcc.l"
return PARAM;
YY_BREAK
case 74:
YY_RULE_SETUP
-#line 366 "compilers/imcc/imcc.l"
+#line 362 "compilers/imcc/imcc.l"
return GOTO;
YY_BREAK
case 75:
YY_RULE_SETUP
-#line 367 "compilers/imcc/imcc.l"
+#line 363 "compilers/imcc/imcc.l"
return IF;
YY_BREAK
case 76:
YY_RULE_SETUP
-#line 368 "compilers/imcc/imcc.l"
+#line 364 "compilers/imcc/imcc.l"
return UNLESS;
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 369 "compilers/imcc/imcc.l"
+#line 365 "compilers/imcc/imcc.l"
return PNULL;
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 370 "compilers/imcc/imcc.l"
+#line 366 "compilers/imcc/imcc.l"
return INTV;
YY_BREAK
case 79:
YY_RULE_SETUP
-#line 371 "compilers/imcc/imcc.l"
+#line 367 "compilers/imcc/imcc.l"
return FLOATV;
YY_BREAK
case 80:
YY_RULE_SETUP
-#line 373 "compilers/imcc/imcc.l"
+#line 369 "compilers/imcc/imcc.l"
return PMCV;
YY_BREAK
case 81:
YY_RULE_SETUP
-#line 374 "compilers/imcc/imcc.l"
+#line 370 "compilers/imcc/imcc.l"
return STRINGV;
YY_BREAK
case 82:
YY_RULE_SETUP
-#line 375 "compilers/imcc/imcc.l"
+#line 371 "compilers/imcc/imcc.l"
return SHIFT_LEFT;
YY_BREAK
case 83:
YY_RULE_SETUP
-#line 376 "compilers/imcc/imcc.l"
+#line 372 "compilers/imcc/imcc.l"
return SHIFT_RIGHT;
YY_BREAK
case 84:
YY_RULE_SETUP
-#line 377 "compilers/imcc/imcc.l"
+#line 373 "compilers/imcc/imcc.l"
return SHIFT_RIGHT_U;
YY_BREAK
case 85:
YY_RULE_SETUP
-#line 378 "compilers/imcc/imcc.l"
+#line 374 "compilers/imcc/imcc.l"
return LOG_AND;
YY_BREAK
case 86:
YY_RULE_SETUP
-#line 379 "compilers/imcc/imcc.l"
+#line 375 "compilers/imcc/imcc.l"
return LOG_OR;
YY_BREAK
case 87:
YY_RULE_SETUP
-#line 380 "compilers/imcc/imcc.l"
+#line 376 "compilers/imcc/imcc.l"
return LOG_XOR;
YY_BREAK
case 88:
YY_RULE_SETUP
-#line 381 "compilers/imcc/imcc.l"
+#line 377 "compilers/imcc/imcc.l"
return RELOP_LT;
YY_BREAK
case 89:
YY_RULE_SETUP
-#line 382 "compilers/imcc/imcc.l"
+#line 378 "compilers/imcc/imcc.l"
return RELOP_LTE;
YY_BREAK
case 90:
YY_RULE_SETUP
-#line 383 "compilers/imcc/imcc.l"
+#line 379 "compilers/imcc/imcc.l"
return RELOP_GT;
YY_BREAK
case 91:
YY_RULE_SETUP
-#line 384 "compilers/imcc/imcc.l"
+#line 380 "compilers/imcc/imcc.l"
return RELOP_GTE;
YY_BREAK
case 92:
YY_RULE_SETUP
-#line 385 "compilers/imcc/imcc.l"
+#line 381 "compilers/imcc/imcc.l"
return RELOP_EQ;
YY_BREAK
case 93:
YY_RULE_SETUP
-#line 386 "compilers/imcc/imcc.l"
+#line 382 "compilers/imcc/imcc.l"
return RELOP_NE;
YY_BREAK
case 94:
YY_RULE_SETUP
-#line 387 "compilers/imcc/imcc.l"
+#line 383 "compilers/imcc/imcc.l"
return POW;
YY_BREAK
case 95:
YY_RULE_SETUP
-#line 389 "compilers/imcc/imcc.l"
+#line 385 "compilers/imcc/imcc.l"
return CONCAT;
YY_BREAK
case 96:
YY_RULE_SETUP
-#line 390 "compilers/imcc/imcc.l"
+#line 386 "compilers/imcc/imcc.l"
return DOT;
YY_BREAK
case 97:
YY_RULE_SETUP
-#line 392 "compilers/imcc/imcc.l"
+#line 388 "compilers/imcc/imcc.l"
return PLUS_ASSIGN;
YY_BREAK
case 98:
YY_RULE_SETUP
-#line 393 "compilers/imcc/imcc.l"
+#line 389 "compilers/imcc/imcc.l"
return MINUS_ASSIGN;
YY_BREAK
case 99:
YY_RULE_SETUP
-#line 394 "compilers/imcc/imcc.l"
+#line 390 "compilers/imcc/imcc.l"
return MUL_ASSIGN;
YY_BREAK
case 100:
YY_RULE_SETUP
-#line 395 "compilers/imcc/imcc.l"
+#line 391 "compilers/imcc/imcc.l"
return DIV_ASSIGN;
YY_BREAK
case 101:
YY_RULE_SETUP
-#line 396 "compilers/imcc/imcc.l"
+#line 392 "compilers/imcc/imcc.l"
return MOD_ASSIGN;
YY_BREAK
case 102:
YY_RULE_SETUP
-#line 397 "compilers/imcc/imcc.l"
+#line 393 "compilers/imcc/imcc.l"
return FDIV;
YY_BREAK
case 103:
YY_RULE_SETUP
-#line 398 "compilers/imcc/imcc.l"
+#line 394 "compilers/imcc/imcc.l"
return FDIV_ASSIGN;
YY_BREAK
case 104:
YY_RULE_SETUP
-#line 399 "compilers/imcc/imcc.l"
+#line 395 "compilers/imcc/imcc.l"
return BAND_ASSIGN;
YY_BREAK
case 105:
YY_RULE_SETUP
-#line 400 "compilers/imcc/imcc.l"
+#line 396 "compilers/imcc/imcc.l"
return BOR_ASSIGN;
YY_BREAK
case 106:
YY_RULE_SETUP
-#line 401 "compilers/imcc/imcc.l"
+#line 397 "compilers/imcc/imcc.l"
return BXOR_ASSIGN;
YY_BREAK
case 107:
YY_RULE_SETUP
-#line 402 "compilers/imcc/imcc.l"
+#line 398 "compilers/imcc/imcc.l"
return SHR_ASSIGN;
YY_BREAK
case 108:
YY_RULE_SETUP
-#line 403 "compilers/imcc/imcc.l"
+#line 399 "compilers/imcc/imcc.l"
return SHL_ASSIGN;
YY_BREAK
case 109:
YY_RULE_SETUP
-#line 404 "compilers/imcc/imcc.l"
+#line 400 "compilers/imcc/imcc.l"
return SHR_U_ASSIGN;
YY_BREAK
case 110:
YY_RULE_SETUP
-#line 405 "compilers/imcc/imcc.l"
+#line 401 "compilers/imcc/imcc.l"
return CONCAT_ASSIGN;
YY_BREAK
case 111:
YY_RULE_SETUP
-#line 407 "compilers/imcc/imcc.l"
+#line 403 "compilers/imcc/imcc.l"
{
char *macro_name = NULL;
int start_cond = YY_START;
@@ -3584,7 +3566,7 @@
YY_BREAK
case 112:
YY_RULE_SETUP
-#line 450 "compilers/imcc/imcc.l"
+#line 446 "compilers/imcc/imcc.l"
{
/* the initial whitespace catcher misses this one */
SET_LINE_NUMBER;
@@ -3593,7 +3575,7 @@
YY_BREAK
case 113:
YY_RULE_SETUP
-#line 456 "compilers/imcc/imcc.l"
+#line 452 "compilers/imcc/imcc.l"
{
const int c = yylex(valp,yyscanner,interp);
@@ -3608,7 +3590,7 @@
YY_BREAK
case 114:
YY_RULE_SETUP
-#line 468 "compilers/imcc/imcc.l"
+#line 464 "compilers/imcc/imcc.l"
{
if (valp) {
char *label;
@@ -3633,7 +3615,7 @@
YY_BREAK
case 115:
YY_RULE_SETUP
-#line 490 "compilers/imcc/imcc.l"
+#line 486 "compilers/imcc/imcc.l"
{
if (valp) {
char *label;
@@ -3656,12 +3638,12 @@
YY_BREAK
case 116:
YY_RULE_SETUP
-#line 510 "compilers/imcc/imcc.l"
+#line 506 "compilers/imcc/imcc.l"
return COMMA;
YY_BREAK
case 117:
YY_RULE_SETUP
-#line 512 "compilers/imcc/imcc.l"
+#line 508 "compilers/imcc/imcc.l"
{
/* trim last ':' */
YYCHOP();
@@ -3674,7 +3656,7 @@
YY_BREAK
case 118:
YY_RULE_SETUP
-#line 522 "compilers/imcc/imcc.l"
+#line 518 "compilers/imcc/imcc.l"
{
char * const macro_name = mem_sys_strdup(yytext + 1);
int failed = expand_macro(interp, macro_name, yyscanner);
@@ -3687,32 +3669,32 @@
YY_BREAK
case 119:
YY_RULE_SETUP
-#line 534 "compilers/imcc/imcc.l"
+#line 530 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, FLOATC);
YY_BREAK
case 120:
YY_RULE_SETUP
-#line 535 "compilers/imcc/imcc.l"
+#line 531 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 121:
YY_RULE_SETUP
-#line 536 "compilers/imcc/imcc.l"
+#line 532 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 122:
YY_RULE_SETUP
-#line 537 "compilers/imcc/imcc.l"
+#line 533 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 123:
YY_RULE_SETUP
-#line 538 "compilers/imcc/imcc.l"
+#line 534 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 124:
YY_RULE_SETUP
-#line 540 "compilers/imcc/imcc.l"
+#line 536 "compilers/imcc/imcc.l"
{
valp->s = mem_sys_strdup(yytext);
@@ -3721,7 +3703,7 @@
YY_BREAK
case 125:
YY_RULE_SETUP
-#line 546 "compilers/imcc/imcc.l"
+#line 542 "compilers/imcc/imcc.l"
{
macro_frame_t *frame;
@@ -3752,7 +3734,7 @@
YY_BREAK
case 126:
YY_RULE_SETUP
-#line 574 "compilers/imcc/imcc.l"
+#line 570 "compilers/imcc/imcc.l"
{
/* charset:"..." */
valp->s = mem_sys_strdup(yytext);
@@ -3763,7 +3745,7 @@
YY_BREAK
case 127:
YY_RULE_SETUP
-#line 582 "compilers/imcc/imcc.l"
+#line 578 "compilers/imcc/imcc.l"
{
if (valp) (valp)->s = yytext;
if (IMCC_INFO(interp)->state->pasm_file)
@@ -3774,7 +3756,7 @@
YY_BREAK
case 128:
YY_RULE_SETUP
-#line 590 "compilers/imcc/imcc.l"
+#line 586 "compilers/imcc/imcc.l"
{
if (valp) (valp)->s = yytext;
if (IMCC_INFO(interp)->state->pasm_file)
@@ -3785,7 +3767,7 @@
YY_BREAK
case 129:
YY_RULE_SETUP
-#line 598 "compilers/imcc/imcc.l"
+#line 594 "compilers/imcc/imcc.l"
{
if (valp) (valp)->s = yytext;
if (IMCC_INFO(interp)->state->pasm_file)
@@ -3796,7 +3778,7 @@
YY_BREAK
case 130:
YY_RULE_SETUP
-#line 606 "compilers/imcc/imcc.l"
+#line 602 "compilers/imcc/imcc.l"
{
if (valp) (valp)->s = yytext;
if (IMCC_INFO(interp)->state->pasm_file)
@@ -3807,7 +3789,7 @@
YY_BREAK
case 131:
YY_RULE_SETUP
-#line 614 "compilers/imcc/imcc.l"
+#line 610 "compilers/imcc/imcc.l"
{
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
"'%s' is not a valid register name", yytext);
@@ -3815,7 +3797,7 @@
YY_BREAK
case 132:
YY_RULE_SETUP
-#line 619 "compilers/imcc/imcc.l"
+#line 615 "compilers/imcc/imcc.l"
{
if (IMCC_INFO(interp)->state->pasm_file == 0)
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
@@ -3829,24 +3811,24 @@
YY_BREAK
case 133:
YY_RULE_SETUP
-#line 631 "compilers/imcc/imcc.l"
+#line 627 "compilers/imcc/imcc.l"
{ return handle_identifier(interp, valp, yytext); }
YY_BREAK
case 134:
YY_RULE_SETUP
-#line 633 "compilers/imcc/imcc.l"
+#line 629 "compilers/imcc/imcc.l"
/* skip */;
YY_BREAK
case 135:
YY_RULE_SETUP
-#line 635 "compilers/imcc/imcc.l"
+#line 631 "compilers/imcc/imcc.l"
{
/* catch all except for state macro */
return yytext[0];
}
YY_BREAK
case YY_STATE_EOF(emit):
-#line 640 "compilers/imcc/imcc.l"
+#line 636 "compilers/imcc/imcc.l"
{
BEGIN(INITIAL);
@@ -3859,12 +3841,12 @@
}
YY_BREAK
case YY_STATE_EOF(INITIAL):
-#line 651 "compilers/imcc/imcc.l"
+#line 647 "compilers/imcc/imcc.l"
yyterminate();
YY_BREAK
case 136:
YY_RULE_SETUP
-#line 653 "compilers/imcc/imcc.l"
+#line 649 "compilers/imcc/imcc.l"
{
/* the initial whitespace catcher misses this one */
SET_LINE_NUMBER;
@@ -3874,19 +3856,19 @@
case 137:
/* rule 137 can match eol */
YY_RULE_SETUP
-#line 659 "compilers/imcc/imcc.l"
+#line 655 "compilers/imcc/imcc.l"
{
DUP_AND_RET(valp, '\n');
}
YY_BREAK
case 138:
YY_RULE_SETUP
-#line 663 "compilers/imcc/imcc.l"
+#line 659 "compilers/imcc/imcc.l"
return LABEL;
YY_BREAK
case 139:
YY_RULE_SETUP
-#line 665 "compilers/imcc/imcc.l"
+#line 661 "compilers/imcc/imcc.l"
{
if (yylex(valp,yyscanner,interp) != LABEL)
@@ -3913,7 +3895,7 @@
YY_BREAK
case 140:
YY_RULE_SETUP
-#line 689 "compilers/imcc/imcc.l"
+#line 685 "compilers/imcc/imcc.l"
{
if (valp) {
if (!IMCC_INFO(interp)->cur_macro_name) {
@@ -3944,44 +3926,44 @@
YY_BREAK
case 141:
YY_RULE_SETUP
-#line 717 "compilers/imcc/imcc.l"
+#line 713 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, ' ');
YY_BREAK
case 142:
YY_RULE_SETUP
-#line 718 "compilers/imcc/imcc.l"
+#line 714 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, REG);
YY_BREAK
case 143:
YY_RULE_SETUP
-#line 719 "compilers/imcc/imcc.l"
+#line 715 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, REG);
YY_BREAK
case 144:
YY_RULE_SETUP
-#line 720 "compilers/imcc/imcc.l"
+#line 716 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, IDENTIFIER);
YY_BREAK
case 145:
YY_RULE_SETUP
-#line 721 "compilers/imcc/imcc.l"
+#line 717 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, MACRO);
YY_BREAK
case 146:
YY_RULE_SETUP
-#line 722 "compilers/imcc/imcc.l"
+#line 718 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, yytext[0]);
YY_BREAK
case YY_STATE_EOF(macro):
-#line 723 "compilers/imcc/imcc.l"
+#line 719 "compilers/imcc/imcc.l"
yyterminate();
YY_BREAK
case 147:
YY_RULE_SETUP
-#line 725 "compilers/imcc/imcc.l"
+#line 721 "compilers/imcc/imcc.l"
ECHO;
YY_BREAK
-#line 3985 "compilers/imcc/imclexer.c"
+#line 3967 "compilers/imcc/imclexer.c"
case YY_STATE_EOF(pod):
case YY_STATE_EOF(cmt1):
case YY_STATE_EOF(cmt2):
@@ -4770,8 +4752,8 @@
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
@@ -5193,7 +5175,7 @@
#define YYTABLES_NAME "yytables"
-#line 725 "compilers/imcc/imcc.l"
+#line 721 "compilers/imcc/imcc.l"
Modified: branches/html_cleanup/compilers/pct/src/PCT/HLLCompiler.pir
==============================================================================
--- branches/html_cleanup/compilers/pct/src/PCT/HLLCompiler.pir Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/compilers/pct/src/PCT/HLLCompiler.pir Sun Oct 24 12:14:32 2010 (r49645)
@@ -18,7 +18,7 @@
load_bytecode 'P6object.pbc'
load_bytecode 'Parrot/Exception.pbc'
$P0 = new 'P6metaclass'
- $S0 = '@stages $parsegrammar $parseactions $astgrammar $commandline_banner $commandline_prompt @cmdoptions $usage $version'
+ $S0 = '@stages $parsegrammar $parseactions $astgrammar $commandline_banner $commandline_prompt @cmdoptions $usage $version $compiler_progname'
$P0.'new_class'('PCT::HLLCompiler', 'attr'=>$S0)
.end
@@ -154,6 +154,11 @@
The prompt is displayed in interactive mode at each point where
the compiler is ready for code to be compiled and executed.
+=item compiler_progname([string name])
+
+Accessor for the C<compiler_progname>, which is often the filename of
+the compiler's program entry point, like C<perl6.pbc>.
+
=cut
.sub 'stages' :method
@@ -192,6 +197,12 @@
.tailcall self.'attr'('$commandline_prompt', value, has_value)
.end
+.sub 'compiler_progname' :method
+ .param pmc value :optional
+ .param int has_value :opt_flag
+ .tailcall self.'attr'('$compiler_progname', value, has_value)
+.end
+
=item removestage(string stagename)
Delete a stage from the compilation process queue.
@@ -786,6 +797,7 @@
.local string arg0
arg0 = shift args
+ self.'compiler_progname'(arg0)
.local pmc getopts
getopts = new ['Getopt';'Obj']
getopts.'notOptStop'(1)
Modified: branches/html_cleanup/compilers/pct/src/POST/Compiler.pir
==============================================================================
--- branches/html_cleanup/compilers/pct/src/POST/Compiler.pir Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/compilers/pct/src/POST/Compiler.pir Sun Oct 24 12:14:32 2010 (r49645)
@@ -130,9 +130,8 @@
pos = cpost['pos']
if null pos goto done_subline
source = cpost['source']
- $I0 = can source, 'lineof'
- unless $I0 goto done_subline
- line = source.'lineof'(pos)
+ if null source goto done_subline
+ line = self.'lineof'(source, pos, 'cache'=>1)
inc line
done_subline:
self.'pir'(cpost)
Modified: branches/html_cleanup/compilers/pirc/src/bcgen.c
==============================================================================
--- branches/html_cleanup/compilers/pirc/src/bcgen.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/compilers/pirc/src/bcgen.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -271,7 +271,7 @@
while (index < count) {
constant = bc->interp->code->const_table->constants[index];
if (constant->type == PFC_STRING) {
- if (Parrot_str_equal(bc->interp, constant->u.string, parrotstr)) {
+ if (STRING_equal(bc->interp, constant->u.string, parrotstr)) {
#if DEBUGBC
fprintf(stderr, "found string %s at index %d\n", str, index);
#endif
@@ -351,7 +351,7 @@
if (constant->type == PFC_KEY) {
STRING *s2 = key_set_to_string(bc->interp, constant->u.key);
- if (Parrot_str_equal(bc->interp, s1, s2)) {
+ if (STRING_equal(bc->interp, s1, s2)) {
#if DEBUGBC
fprintf(stderr, "found equal key (%d)\n", index);
#endif
@@ -1079,7 +1079,7 @@
cur_name = sub->name;
out_name = Parrot_str_new(interp, outername, len);
- if (Parrot_str_compare(interp, cur_name, out_name) == 0)
+ if (STRING_equal(interp, cur_name, out_name))
return current;
return NULL;
Copied: branches/html_cleanup/config/auto/ipv6.pm (from r49644, trunk/config/auto/ipv6.pm)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/auto/ipv6.pm Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/auto/ipv6.pm)
@@ -0,0 +1,67 @@
+# Copyright (C) 2001-2007, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+config/auto/ipv6.pm - determine ipv6 capabilities of local machine
+
+=head1 DESCRIPTION
+
+This configuration step probes the local machine to determine if it capable of
+running an ipv6 stack.
+
+=cut
+
+package auto::ipv6;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step);
+
+use Parrot::Configure::Utils ':auto';
+
+
+sub _init {
+ my $self = shift;
+ my %data;
+ $data{description} = q{Determine IPV6 capabilities};
+ $data{result} = q{};
+ return \%data;
+}
+
+sub runstep {
+ my ( $self, $conf ) = @_;
+
+ my $ipv6_status = 0;
+
+ $conf->cc_gen('config/auto/ipv6/test.in');
+ eval { $conf->cc_build(); };
+ if (!$@) {
+ my $output = eval { $conf->cc_run() };
+ if (!$@ && $output =~ /OK/) {
+ $ipv6_status = 1;
+ }
+ }
+ $conf->cc_clean();
+ $self->_handle_ipv6_status($conf, $ipv6_status);
+
+ return 1;
+}
+
+sub _handle_ipv6_status {
+ my ($self, $conf, $ipv6_status) = @_;
+ $conf->data->set( HAS_IPV6 => $ipv6_status );
+ $ipv6_status
+ ? $self->set_result('yes')
+ : $self->set_result('no');
+}
+
+1;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Copied: branches/html_cleanup/config/auto/ipv6/test.in (from r49644, trunk/config/auto/ipv6/test.in)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/auto/ipv6/test.in Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/auto/ipv6/test.in)
@@ -0,0 +1,71 @@
+/*
+Copyright (C) 2005-2009, Parrot Foundation.
+$Id$
+
+*/
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int c,char**v) {
+ int x = socket( PF_INET6, SOCK_DGRAM, 0 );
+ if ( x < 0 ) {
+ perror("Not OK - socket failed");
+ return EXIT_FAILURE;
+ }
+
+ /*
+ By now we have (a) PF_INET6 defined, and (b) in-principle kernel
+ support for v6; however we don't yet know if we have any v6
+ interfaces.
+ */
+
+ struct in6_addr A = IN6ADDR_LOOPBACK_INIT; /* IN6ADDR_ANY_INIT; */
+ struct sockaddr_in6 S = { AF_INET6 }; /* family is always first field in sockaddr_* */
+ S.sin6_addr = A;
+ S.sin6_port = 32760; /* a pseudorandom 15-bit number */
+
+ /*
+ By now we have struct in6_addr, struct sockaddr_in6 and AF_INET6 and
+ IN6ADDR_LOOPBACK_INIT. But we still don't know about interfaces.
+ */
+
+ #ifdef linux /* might not be supported elsewhere */
+ S.sin6_flowinfo = 0;
+ S.sin6_scope_id = 0;
+ #endif
+
+ /*
+ Set the SO_REUSEADDR option so as not to interfere with anyone else
+ using the port, including running this test again within the
+ re-use timeout period.
+ */
+ int reuse_address = 1;
+ if ( setsockopt(x, SOL_SOCKET, SO_REUSEADDR, &reuse_address, sizeof(reuse_address)) < 0 ) {
+ perror("Not OK - setsockopt failed");
+ return EXIT_FAILURE;
+ }
+
+ if ( bind( x, (void*) &S, sizeof(S) ) < 0 && errno != EADDRINUSE ) {
+ perror("Not OK - bind failed");
+ return EXIT_FAILURE;
+ }
+
+ /*
+ By now we know we can bind to "::1", which means we truly do have
+ IPv6 support. Of course, we might not have any useful routes off
+ this host, but that wasn't the question.
+ */
+ puts("OK");
+ close(x);
+ return EXIT_SUCCESS;
+}
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Copied: branches/html_cleanup/config/auto/stat.pm (from r49644, trunk/config/auto/stat.pm)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/auto/stat.pm Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/auto/stat.pm)
@@ -0,0 +1,71 @@
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+config/auto/stat.pm - stat extension detection
+
+=head1 DESCRIPTION
+
+Determining if the system has BSD stat extensions.
+
+=cut
+
+package auto::stat;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step);
+
+use Parrot::Configure::Utils ':auto';
+
+sub _init {
+ my $self = shift;
+ my %data;
+ $data{description} = q{Detect stat type};
+ $data{result} = q{};
+ return \%data;
+}
+
+sub runstep {
+ my ( $self, $conf ) = @_;
+
+ my $bsd_stat = 0;
+
+ $conf->cc_gen('config/auto/stat/test_c.in');
+ eval { $conf->cc_build(); };
+ if (!$@) {
+ my $output = eval { $conf->cc_run() };
+ if (!$@ && $output =~ /OK/) {
+ $bsd_stat = 1;
+ }
+ }
+
+ $self->_handle_bsd_stat($conf, $bsd_stat);
+ $conf->cc_clean();
+
+ return 1;
+}
+
+sub _handle_bsd_stat {
+ my ($self, $conf, $bsd_stat) = @_;
+ if ($bsd_stat) {
+ $conf->data->set( HAS_BSD_STAT_EXTN => 1 );
+ $self->set_result('bsd');
+ }
+ else {
+ $conf->data->set( HAS_BSD_STAT_EXTN => 0 );
+ $self->set_result('posix');
+ }
+}
+
+1;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
+
Copied: branches/html_cleanup/config/auto/stat/test_c.in (from r49644, trunk/config/auto/stat/test_c.in)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/auto/stat/test_c.in Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/auto/stat/test_c.in)
@@ -0,0 +1,28 @@
+/*
+Copyright (C) 2010, Parrot Foundation.
+$Id$
+
+seeing if struct stat has BSD extensions
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/stat.h>
+
+int
+main()
+{
+ struct stat st;
+ st.st_blocks = 22;
+ st.st_blksize = 500;
+ printf("OK: %d %d", st.st_blocks, st.st_blksize);
+ return EXIT_SUCCESS;
+}
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Copied: branches/html_cleanup/config/auto/timespec.pm (from r49644, trunk/config/auto/timespec.pm)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/auto/timespec.pm Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/auto/timespec.pm)
@@ -0,0 +1,63 @@
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+config/auto/timespec.pm - Timespec detection
+
+=head1 DESCRIPTION
+
+Determining if the system has C<struct timespec> defined.
+
+=cut
+
+package auto::timespec;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step);
+
+use Parrot::Configure::Utils ':auto';
+
+sub _init {
+ my $self = shift;
+ my %data;
+ $data{description} = q{Does your system has timespec};
+ $data{result} = q{};
+ return \%data;
+}
+
+sub runstep {
+ my ( $self, $conf ) = @_;
+
+ $conf->cc_gen('config/auto/timespec/test_c.in');
+ eval { $conf->cc_build(); };
+ my $fail_message = $@;
+ $self->_handle_timespec($conf, $fail_message);
+ $conf->cc_clean();
+
+ return 1;
+}
+
+sub _handle_timespec {
+ my ($self, $conf, $fail_message) = @_;
+ if ($fail_message) {
+ $conf->data->set( HAS_TIMESPEC => 0 );
+ $self->set_result('no');
+ }
+ else {
+ $conf->data->set( HAS_TIMESPEC => 1 );
+ $self->set_result('yes');
+ }
+}
+
+1;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
+
Copied: branches/html_cleanup/config/auto/timespec/test_c.in (from r49644, trunk/config/auto/timespec/test_c.in)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/auto/timespec/test_c.in Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/auto/timespec/test_c.in)
@@ -0,0 +1,26 @@
+/*
+Copyright (C) 2008-2009, Parrot Foundation.
+$Id$
+
+seeing if struct timespec exists
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+int
+main()
+{
+ struct timespec ts;
+ printf("OK: %d", sizeof ts);
+ return EXIT_SUCCESS;
+}
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/html_cleanup/config/gen/config_pm/myconfig.in
==============================================================================
--- branches/html_cleanup/config/gen/config_pm/myconfig.in Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/config/gen/config_pm/myconfig.in Sun Oct 24 12:14:32 2010 (r49645)
@@ -9,12 +9,21 @@
Compiler:
cc='@cc@', ccflags='@ccflags@',
Linker and Libraries:
+ link='@link@', linkflags='@linkflags@',
ld='@ld@', ldflags='@ldflags@',
cc_ldflags='@cc_ldflags@',
libs='@libs@'
Dynamic Linking:
- share_ext='@share_ext@', ld_share_flags='@ld_share_flags@',
- load_ext='@load_ext@', ld_load_flags='@ld_load_flags@'
+ cc_shared='@cc_shared@',
+ link_dynamic='@link_dynamic@',
+ ld_share_flags='@ld_share_flags@',
+ ld_load_flags='@ld_load_flags@'
+ Extensions:
+ o='@o@', a='@a@', exe='@exe@',
+ share_ext='@share_ext@', load_ext='@load_ext@'
+ Misc Programs:
+ ar='@ar@', ranlib='@ranlib@',
+ make='@make@', make_set_make='@make_set_make@'
Types:
iv=@iv@, intvalsize=@intvalsize@, intsize=@intsize@, opcode_t=@opcode_t@, opcode_t_size=@opcode_t_size@,
ptrsize=@ptrsize@, byteorder=@byteorder@,
Modified: branches/html_cleanup/config/gen/makefiles/root.in
==============================================================================
--- branches/html_cleanup/config/gen/makefiles/root.in Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/config/gen/makefiles/root.in Sun Oct 24 12:14:32 2010 (r49645)
@@ -79,7 +79,7 @@
RM_F = @rm_f@
RM_RF = @rm_rf@
TOUCH = @touch@
-AR_CR = @ar@ @ar_flags@
+AR_CR = @ar@ @arflags@
RANLIB = @ranlib@
YACC = @yacc@
LEX = @lex@
@@ -409,7 +409,6 @@
$(INC_DIR)/core_pmcs.h \
$(INC_DIR)/compiler.h \
$(INC_DIR)/cclass.h \
- $(INC_DIR)/list.h \
include/pmc/pmc_callcontext.h
# generated list of header files
@@ -423,6 +422,7 @@
ENCODING_O_FILES = \
src/string/encoding/shared$(O) \
src/string/encoding/tables$(O) \
+ src/string/encoding/null$(O) \
src/string/encoding/ascii$(O) \
src/string/encoding/latin1$(O) \
src/string/encoding/binary$(O) \
@@ -617,7 +617,7 @@
corevm \
docs \
#IF(has_glut): $(LIBGLUTCB_SO) \
- $(EXTRANCITHUNKS_SO) \
+#IF(has_dynamic_linking): $(EXTRANCITHUNKS_SO) \
$(DIS) \
$(PARROT_CONFIG) \
$(PBC_TO_EXE) \
@@ -630,9 +630,11 @@
$(PCT_LIB_PBCS) \
$(DATA_JSON_LIB_PBCS) \
$(NQP_LIB_PBCS) \
+#IF(has_dynamic_linking): $(DYNOPLIBS_TARGETS) \
+#IF(has_dynamic_linking): $(LIBNCI_TEST_SO) \
$(GEN_LIBRARY) \
- $(DYNOPLIBS_TARGETS) \
- $(LIBNCI_TEST_SO)
+ src/install_config$(O) \
+
# We build DYNPMC_TARGET in corevm. It's kinda hack to test t/pmc/threads.t CLONE_LIBRARIES
corevm : \
@@ -641,7 +643,7 @@
$(PARROT) \
runtime/parrot/include/parrotlib.pbc \
runtime/parrot/include/config.fpmc \
- $(DYNPMC_TARGETS) \
+#IF(has_dynamic_linking): $(DYNPMC_TARGETS) \
$(LIBRARY_DIR)/Test/More.pbc
$(GEN_LIBRARY) : $(PARROT) $(GEN_PASM_INCLUDES)
@@ -923,7 +925,10 @@
src/null_config$(O) : $(PARROT_H_HEADERS) src/null_config.c
-src/list$(O): $(PARROT_H_HEADERS) include/pmc/pmc_callcontext.h src/list.c
+src/list$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/list.c \
+ $(INC_DIR)/list.h
src/oo$(O) : $(PARROT_H_HEADERS) include/pmc/pmc_class.h src/oo.c \
include/pmc/pmc_object.h src/oo.str $(INC_DIR)/oo_private.h
@@ -1294,18 +1299,45 @@
src/key$(O) : $(PARROT_H_HEADERS) src/key.str src/key.c \
include/pmc/pmc_key.h
-src/gc/mark_sweep$(O) : $(PARROT_H_HEADERS) src/gc/gc_private.h src/gc/mark_sweep.c
+src/gc/mark_sweep$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/gc/gc_private.h \
+ src/gc/mark_sweep.c \
+ src/gc/variable_size_pool.h
-src/gc/gc_ms$(O) : $(PARROT_H_HEADERS) src/gc/gc_private.h src/gc/gc_ms.c
+src/gc/gc_ms$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/gc/gc_private.h \
+ src/gc/gc_ms.c \
+ src/gc/variable_size_pool.h \
+ $(INC_DIR)/list.h
-src/gc/gc_inf$(O) : $(PARROT_H_HEADERS) src/gc/gc_private.h src/gc/gc_inf.c
+src/gc/gc_inf$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/gc/gc_private.h \
+ src/gc/gc_inf.c \
+ src/gc/variable_size_pool.h
-src/gc/gc_ms2$(O) : $(PARROT_H_HEADERS) src/gc/gc_private.h src/gc/fixed_allocator.h src/gc/gc_ms2.c
+src/gc/gc_ms2$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/gc/gc_private.h \
+ src/gc/fixed_allocator.h \
+ src/gc/gc_ms2.c \
+ $(INC_DIR)/list.h \
+ src/gc/variable_size_pool.h \
+ $(INC_DIR)/sysmem.h
-src/gc/api$(O) : $(PARROT_H_HEADERS) src/gc/gc_private.h src/gc/api.c
+src/gc/api$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/gc/gc_private.h \
+ src/gc/api.c \
+ src/gc/variable_size_pool.h
-src/gc/alloc_resources$(O) : $(PARROT_H_HEADERS) \
- src/gc/gc_private.h src/gc/alloc_resources.c
+src/gc/alloc_resources$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/gc/variable_size_pool.h \
+ src/gc/gc_private.h \
+ src/gc/alloc_resources.c
src/gc/fixed_allocator$(O) : $(PARROT_H_HEADERS) \
src/gc/fixed_allocator.h src/gc/fixed_allocator.c
@@ -1313,20 +1345,31 @@
src/gc/variable_size_pool$(O) : $(PARROT_H_HEADERS) \
src/gc/variable_size_pool.h src/gc/variable_size_pool.c
-src/gc/string_gc$(O) : $(PARROT_H_HEADERS) \
- src/gc/gc_private.h src/gc/string_gc.c
+src/gc/string_gc$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/gc/gc_private.h \
+ src/gc/string_gc.c \
+ src/gc/variable_size_pool.h
src/hll$(O) : $(PARROT_H_HEADERS) src/hll.str $(INC_DIR)/dynext.h src/hll.c
-src/platform$(O) : $(PARROT_H_HEADERS) src/platform.c
+src/platform$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/platform.c \
+ $(INC_DIR)/sysmem.h
#IF(platform_asm):src/platform_asm$(O) : $(PARROT_H_HEADERS)
#IF(platform_asm):
src/core_pmcs$(O) : $(PARROT_H_HEADERS) src/core_pmcs.c
-src/runcore/trace$(O) : include/pmc/pmc_sub.h src/runcore/trace.c \
- $(INC_DIR)/oplib/ops.h $(INC_DIR)/runcore_trace.h \
- $(PARROT_H_HEADERS)
+src/runcore/trace$(O) : \
+ include/pmc/pmc_sub.h \
+ src/runcore/trace.c \
+ $(INC_DIR)/oplib/ops.h \
+ $(INC_DIR)/runcore_trace.h \
+ $(PARROT_H_HEADERS) \
+ $(INC_DIR)/oplib/core_ops.h \
+ $(INC_DIR)/runcore_api.h
src/debug$(O) : $(INC_DIR)/embed.h $(INC_DIR)/extend.h \
$(PARROT_H_HEADERS) src/debug.c \
@@ -1444,7 +1487,8 @@
compilers/imcc/symreg.h \
compilers/imcc/unit.h \
$(INC_DIR)/oplib/ops.h \
- $(INC_DIR)/runcore_api.h
+ $(INC_DIR)/runcore_api.h \
+ src/gc/variable_size_pool.h
src/call/ops$(O) : $(INC_DIR)/oplib/ops.h \
$(PARROT_H_HEADERS) include/pmc/pmc_continuation.h \
@@ -1472,9 +1516,14 @@
src/gc/alloc_memory$(O) : $(PARROT_H_HEADERS) src/gc/alloc_memory.c
-src/main$(O) : $(INC_DIR)/imcc.h $(PARROT_H_HEADERS) \
- $(INC_DIR)/embed.h $(INC_DIR)/runcore_api.h src/gc/gc_private.h \
- src/main.c
+src/main$(O) : \
+ $(INC_DIR)/imcc.h \
+ $(PARROT_H_HEADERS) \
+ $(INC_DIR)/embed.h \
+ $(INC_DIR)/runcore_api.h \
+ src/gc/gc_private.h \
+ src/main.c \
+ src/gc/variable_size_pool.h
src/multidispatch$(O) : \
src/multidispatch.c \
@@ -1562,7 +1611,11 @@
src/vtables$(O) : $(PARROT_H_HEADERS) src/vtables.c
## SUFFIX OVERRIDE
-src/gc/system$(O) : $(PARROT_H_HEADERS) src/gc/gc_private.h src/gc/system.c
+src/gc/system$(O) : \
+ $(PARROT_H_HEADERS) \
+ src/gc/gc_private.h \
+ src/gc/system.c\
+ src/gc/variable_size_pool.h
$(CC) $(CFLAGS) @optimize::src/gc/system.c@ @ccwarn::src/gc/system.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/gc/system.c
src/gc/gc_private.h : $(INC_DIR)/settings.h
@@ -1593,6 +1646,7 @@
src/string/encoding/shared$(O) : $(PARROT_H_HEADERS) \
src/string/encoding/shared.h \
src/string/encoding/tables.h
+src/string/encoding/null$(O) : $(PARROT_H_HEADERS)
src/string/encoding/ascii$(O) : $(PARROT_H_HEADERS) \
src/string/encoding/shared.h \
src/string/encoding/tables.h
Modified: branches/html_cleanup/config/gen/platform.pm
==============================================================================
--- branches/html_cleanup/config/gen/platform.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/config/gen/platform.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -198,6 +198,7 @@
misc.c
hires_timer.c
pid.c
+ sysmem.c
/;
my $plat_c = q{src/platform.c};
Copied: branches/html_cleanup/config/gen/platform/darwin/sysmem.c (from r49644, trunk/config/gen/platform/darwin/sysmem.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/gen/platform/darwin/sysmem.c Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/gen/platform/darwin/sysmem.c)
@@ -0,0 +1,70 @@
+/*
+ * $Id$
+ * Copyright (C) 2010, Parrot Foundation.
+ */
+
+/*
+
+=head1 NAME
+
+config/gen/platform/darwin/sysmem.c
+
+=head1 DESCRIPTION
+
+Get system memory information.
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+#include <sys/sysctl.h>
+#include <stdio.h>
+
+/*
+
+=item C<size_t Parrot_sysmem_amount(PARROT_INTERP)>
+
+Get information about available physical memory.
+
+=cut
+
+*/
+
+size_t
+Parrot_sysmem_amount(PARROT_INTERP)
+{
+ int err = 0 ;
+ size_t memsize = 0 ;
+ char *err_msg;
+ unsigned long length = sizeof (memsize) ;
+
+ int selection[2] = { CTL_HW, HW_PHYSMEM } ;
+
+ err = sysctl(selection, 2, &memsize, &length, NULL, 0) ;
+
+ if (err) {
+ err_msg = strerror(err);
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_EXTERNAL_ERROR,
+ "sysctl failed: %s", err_msg);
+ }
+
+ return memsize;
+}
+
+/*
+
+=back
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Copied: branches/html_cleanup/config/gen/platform/freebsd/sysmem.c (from r49644, trunk/config/gen/platform/freebsd/sysmem.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/gen/platform/freebsd/sysmem.c Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/gen/platform/freebsd/sysmem.c)
@@ -0,0 +1,70 @@
+/*
+ * $Id$
+ * Copyright (C) 2010, Parrot Foundation.
+ */
+
+/*
+
+=head1 NAME
+
+config/gen/platform/freebsd/sysmem.c
+
+=head1 DESCRIPTION
+
+Get system memory information.
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+#include <sys/sysctl.h>
+#include <stdio.h>
+
+/*
+
+=item C<size_t Parrot_sysmem_amount(PARROT_INTERP)>
+
+Get information about available physical memory.
+
+=cut
+
+*/
+
+size_t
+Parrot_sysmem_amount(PARROT_INTERP)
+{
+ int err = 0;
+ size_t memsize = 0;
+ char *err_msg;
+ unsigned long length = sizeof (memsize);
+
+ int selection[2] = { CTL_HW, HW_PHYSMEM };
+
+ err = sysctl(selection, 2, &memsize, &length, NULL, 0);
+
+ if (err) {
+ err_msg = strerror(err);
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_EXTERNAL_ERROR,
+ "sysctl failed: %s", err_msg);
+ }
+
+ return memsize;
+}
+
+/*
+
+=back
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/html_cleanup/config/gen/platform/generic/stat.c
==============================================================================
--- branches/html_cleanup/config/gen/platform/generic/stat.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/config/gen/platform/generic/stat.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -177,10 +177,20 @@
result = statbuf->st_rdev;
break;
case STAT_PLATFORM_BLOCKSIZE:
+#ifdef PARROT_HAS_BSD_STAT_EXTN
result = statbuf->st_blksize;
+#else
+ Parrot_ex_throw_from_c_args(interp, NULL, 1,
+ "STAT_PLATFORM_BLOCKSIZE not supported");
+#endif
break;
case STAT_PLATFORM_BLOCKS:
+#ifdef PARROT_HAS_BSD_STAT_EXTN
result = statbuf->st_blocks;
+#else
+ Parrot_ex_throw_from_c_args(interp, NULL, 1,
+ "STAT_PLATFORM_BLOCKS not supported");
+#endif
break;
default:
break;
Copied: branches/html_cleanup/config/gen/platform/generic/sysmem.c (from r49644, trunk/config/gen/platform/generic/sysmem.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/gen/platform/generic/sysmem.c Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/gen/platform/generic/sysmem.c)
@@ -0,0 +1,60 @@
+/*
+ * $Id$
+ * Copyright (C) 2010, Parrot Foundation.
+ */
+
+/*
+
+=head1 NAME
+
+config/gen/platform/generic/sysmem.c
+
+=head1 DESCRIPTION
+
+Get system memory information.
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include <unistd.h>
+#include "parrot/sysmem.h"
+
+#ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */
+# define _SC_PAGE_SIZE _SC_PAGESIZE
+#endif
+
+/*
+
+=item C<size_t Parrot_sysmem_amount(PARROT_INTERP)>
+
+Get information about available physical memory.
+
+=cut
+
+*/
+
+size_t
+Parrot_sysmem_amount(PARROT_INTERP)
+{
+ return sysconf(_SC_AVPHYS_PAGES) * sysconf(_SC_PAGE_SIZE);
+}
+
+/*
+
+=back
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Deleted: branches/html_cleanup/config/gen/platform/win32/stat.c
==============================================================================
--- branches/html_cleanup/config/gen/platform/win32/stat.c Sun Oct 24 12:14:32 2010 (r49644)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,253 +0,0 @@
-/*
- * $Id$
- * Copyright (C) 2007-2008, Parrot Foundation.
- */
-
-/*
-
-=head1 NAME
-
-config/gen/platform/win32/stat.c
-
-=head1 DESCRIPTION
-
-File stat stuff
-
-=head2 Functions
-
-=over 4
-
-=cut
-
-*/
-
-
-/*
-
-=item C<PMC * Parrot_stat_file(PARROT_INTERP, STRING *filename)>
-
-Stat a file. On Win32 this is not yet implemented, so we return a
-C<NULL> PMC, not C<PMCNULL>.
-
-=cut
-
-*/
-
-PMC *
-Parrot_stat_file(PARROT_INTERP, STRING *filename)
-{
- return NULL;
-}
-
-/*
-
-=item C<PMC * Parrot_stat_info_pmc(PARROT_INTERP, STRING *filename, INTVAL
-thing)>
-
-Return stat info on a file as a PMC. Not implemented on Win32, so we
-return C<NULL>, not C<PMCNULL>.
-
-=cut
-
-*/
-
-PMC *
-Parrot_stat_info_pmc(PARROT_INTERP, STRING *filename, INTVAL thing)
-{
- return NULL;
-}
-
-/*
-
-=item C<static INTVAL stat_common(PARROT_INTERP, struct stat *statbuf, INTVAL
-thing, int status)>
-
-Stats the file, and returns the information specified by C<thing>. C<thing> can
-be one of: C<STAT_EXISTS>, C<STAT_FILESIZE>, C<STAT_ISDIR>, C<STAT_ISDEV>,
-C<STAT_ACCESSTIME>, C<STAT_MODIFYTIME>, C<STAT_CHANGETIME>, C<STAT_UID>,
-C<STAT_GID>, C<STAT_PLATFORM_DEV>, C<STAT_PLATFORM_INODE>,
-C<STAT_PLATFORM_NLINKS>, C<STAT_PLATFORM_DEVTYPE>.
-
-C<STAT_BACKUPTIME> and C<STAT_CREATETIME> are not supported on Win32, so will
-return -1.
-
-C<STAT_PLATFORM_BLOCKS> and C<STAT_PLATFORM_BLOCKSIZE> are not supported by
-Win32 and will throw an exception.
-
-=cut
-
-*/
-
-static INTVAL
-stat_common(PARROT_INTERP, struct stat *statbuf, INTVAL thing, int status)
-{
- INTVAL result = -1;
-
- if (thing == STAT_EXISTS)
- return status == 0;
-
- if (status == -1) {
- const char *err = strerror(errno);
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
- "stat failed: %s", err);
- }
-
- switch (thing) {
- case STAT_FILESIZE:
- result = statbuf->st_size;
- break;
- case STAT_ISDIR:
- result = S_ISDIR(statbuf->st_mode);
- break;
- case STAT_ISREG:
- result = S_ISREG(statbuf->st_mode);
- break;
- case STAT_ISDEV:
- result = S_ISCHR(statbuf->st_mode) || S_ISBLK(statbuf->st_mode);
- break;
- case STAT_CREATETIME:
- result = -1;
- break;
- case STAT_ACCESSTIME:
- result = statbuf->st_atime;
- break;
- case STAT_MODIFYTIME:
- result = statbuf->st_mtime;
- break;
- case STAT_CHANGETIME:
- result = statbuf->st_ctime;
- break;
- case STAT_BACKUPTIME:
- result = -1;
- break;
- case STAT_UID:
- result = statbuf->st_uid;
- break;
- case STAT_GID:
- result = statbuf->st_gid;
- break;
- case STAT_PLATFORM_DEV:
- result = statbuf->st_dev;
- break;
- case STAT_PLATFORM_INODE:
- result = statbuf->st_ino;
- break;
- case STAT_PLATFORM_MODE:
- result = statbuf->st_mode;
- break;
- case STAT_PLATFORM_NLINKS:
- result = statbuf->st_nlink;
- break;
- case STAT_PLATFORM_DEVTYPE:
- result = statbuf->st_rdev;
- break;
- case STAT_PLATFORM_BLOCKSIZE:
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "STAT_PLATFORM_BLOCKSIZE not supported");
- break;
- case STAT_PLATFORM_BLOCKS:
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "STAT_PLATFORM_BLOCKS not supported");
- break;
- default:
- break;
- }
-
- return result;
-}
-
-/*
-
-=item C<INTVAL Parrot_stat_info_intval(PARROT_INTERP, STRING *file, INTVAL
-thing)>
-
-Returns the stat field given by C<thing> of file C<file>.
-
-=cut
-
-*/
-
-INTVAL
-Parrot_stat_info_intval(PARROT_INTERP, STRING *file, INTVAL thing)
-{
- struct stat statbuf;
-
- /* Get the name of the file as something we can use */
- char * const filename = Parrot_str_to_cstring(interp, file);
-
- /* Everything needs the result of stat, so just go do it */
- const int status = stat(filename, &statbuf);
- Parrot_str_free_cstring(filename);
- return stat_common(interp, &statbuf, thing, status);
-}
-
-/*
-
-=item C<INTVAL Parrot_fstat_info_intval(PARROT_INTERP, INTVAL file, INTVAL
-thing)>
-
-Returns the fstat field given by C<thing> from file identifier C<file>.
-
-=cut
-
-*/
-
-INTVAL
-Parrot_fstat_info_intval(PARROT_INTERP, INTVAL file, INTVAL thing)
-{
- struct stat statbuf;
- int status;
-
- /* Everything needs the result of stat, so just go do it */
- status = fstat(file, &statbuf);
- return stat_common(interp, &statbuf, thing, status);
-}
-
-/*
-
-=item C<FLOATVAL Parrot_stat_info_floatval(PARROT_INTERP, STRING *filename,
-INTVAL thing)>
-
-Currently returns C<-1.0> and has no side effects.
-
-=cut
-
-*/
-
-FLOATVAL
-Parrot_stat_info_floatval(PARROT_INTERP, STRING *filename, INTVAL thing)
-{
- return (FLOATVAL)-1;
-}
-
-/*
-
-=item C<STRING * Parrot_stat_info_string(PARROT_INTERP, STRING *filename, INTVAL
-thing)>
-
-Not implemented. Returns C<NULL>.
-
-=cut
-
-*/
-
-STRING *
-Parrot_stat_info_string(PARROT_INTERP, STRING *filename, INTVAL thing)
-{
- return NULL;
-}
-
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Copied: branches/html_cleanup/config/gen/platform/win32/sysmem.c (from r49644, trunk/config/gen/platform/win32/sysmem.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/config/gen/platform/win32/sysmem.c Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/config/gen/platform/win32/sysmem.c)
@@ -0,0 +1,79 @@
+/*
+ * $Id$
+ * Copyright (C) 2010, Parrot Foundation.
+ */
+
+/*
+
+=head1 NAME
+
+config/gen/platform/win32/sysmem.c
+
+=head1 DESCRIPTION
+
+Get system memory information.
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include "parrot/sysmem.h"
+
+/* Solution copied from http://www.perlmonks.org/?node_id=749964 */
+#if defined __MINGW32__ && __GNUC__ < 4
+typedef struct _MEMORYSTATUSEX {
+ DWORD dwLength;
+ DWORD dwMemoryLoad;
+ DWORDLONG ullTotalPhys;
+ DWORDLONG ullAvailPhys;
+ DWORDLONG ullTotalPageFile;
+ DWORDLONG ullAvailPageFile;
+ DWORDLONG ullTotalVirtual;
+ DWORDLONG ullAvailVirtual;
+ DWORDLONG ullAvailExtendedVirtual;
+} MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
+
+WINBASEAPI BOOL WINAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX);
+#endif
+
+/*
+
+=item C<size_t Parrot_sysmem_amount(PARROT_INTERP)>
+
+Get information about available physical memory.
+
+=cut
+
+*/
+
+size_t
+Parrot_sysmem_amount(PARROT_INTERP)
+{
+ /* Copy-pasted from example at */
+ /* http://msdn.microsoft.com/en-us/library/aa366589(v=VS.85).aspx */
+ MEMORYSTATUSEX statex;
+
+ statex.dwLength = sizeof (MEMORYSTATUSEX);
+ GlobalMemoryStatusEx(&statex);
+ /* TODO Check status and bail out */
+ return statex.ullAvailPhys;
+}
+
+/*
+
+=back
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/html_cleanup/config/init/defaults.pm
==============================================================================
--- branches/html_cleanup/config/init/defaults.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/config/init/defaults.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -197,7 +197,7 @@
touch => '$(PERL) -MExtUtils::Command -e touch',
ar => $Config{ar},
- ar_flags => 'cr',
+ arflags => 'cr',
# for Win32
ar_out => '',
Modified: branches/html_cleanup/config/init/hints/mswin32.pm
==============================================================================
--- branches/html_cleanup/config/init/hints/mswin32.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/config/init/hints/mswin32.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -99,7 +99,7 @@
libparrot_static => 'libparrot' . $conf->data->get('a'),
libparrot_shared => "libparrot$share_ext",
ar => 'lib',
- ar_flags => '',
+ arflags => '',
ar_out => '-out:',
slash => '\\',
ccflags => $ccflags,
@@ -150,7 +150,7 @@
ld_out => '-out:',
ldflags => '-nologo -nodefaultlib',
ar => 'xilib',
- ar_flags => '',
+ arflags => '',
ar_out => '-out:',
slash => '\\',
ccflags => $ccflags,
@@ -195,7 +195,7 @@
linkflags => '',
ar => 'tlib /a /P128',
- ar_flags => '',
+ arflags => '',
ar_out => '',
ar_extra => '',
slash => '\\',
Modified: branches/html_cleanup/config/inter/progs.pm
==============================================================================
--- branches/html_cleanup/config/inter/progs.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/config/inter/progs.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -75,7 +75,7 @@
my ($conf, $ask) = @_;
# Set each variable individually so that hints files can use them as
# triggers to help pick the correct defaults for later answers.
- my ( $cc, $link, $ld, $ccflags, $linkflags, $ldflags, $libs, $lex, $yacc );
+ my ( $cc, $link, $ld, $ccflags, $linkflags, $ar, $arflags, $ldflags, $libs, $lex, $yacc );
$cc = integrate( $conf->data->get('cc'), $conf->options->get('cc') );
$cc = prompt( "What C compiler do you want to use?", $cc )
if $ask;
@@ -102,6 +102,16 @@
$conf->debug("\nccflags: $ccflags\n");
+ $ar = integrate( $conf->data->get('ar'), $conf->options->get('ar') );
+ $ar = prompt( "What archiver do you want to use to build static libraries?", $ar ) if $ask;
+ $conf->data->set( ar => $ar );
+
+ $arflags = integrate( $conf->data->get('arflags'), $conf->options->get('arflags') );
+ $arflags = prompt( "What flags should your archiver receive to create static libraries?",
+ $arflags) if $ask;
+ $conf->data->set( arflags => $arflags );
+
+
$linkflags = $conf->data->get('linkflags');
# Remove the path to the Perl library (from Win32 config).
# See TT #854.
Modified: branches/html_cleanup/docs/parrothist.pod
==============================================================================
--- branches/html_cleanup/docs/parrothist.pod Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/docs/parrothist.pod Sun Oct 24 12:14:32 2010 (r49645)
@@ -115,4 +115,7 @@
mikehh 2.7.0 2010-Aug-17 "Australian King"
Gerd 2.8.0 2010-Sep-21 "Tui Parakeet"
+ Gerd 2.9.0 * 2010-Oct-19 "Red-masked"
+ cotto 2.9.1 2010-Oct-19 (bugfix release)
+
=cut
Modified: branches/html_cleanup/docs/pdds/pdd22_io.pod
==============================================================================
--- branches/html_cleanup/docs/pdds/pdd22_io.pod Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/docs/pdds/pdd22_io.pod Sun Oct 24 12:14:32 2010 (r49645)
@@ -863,7 +863,7 @@
C<socket> returns a new socket object from a given address family,
socket type, and protocol number (all integers). The socket object's
-boolean value can be tested for whether the socket was created.
+boolean value can be tested to see if the socket is open or closed.
The asynchronous version takes an additional final PMC callback
argument, and only returns a status object. When the socket operation is
@@ -872,7 +872,7 @@
=item *
-C<sockaddr> returns an object representing a socket address, generated
+C<sockaddr> returns a SockAddr object representing a socket address, generated
from a port number (integer) and an address (string).
No asynchronous version.
Modified: branches/html_cleanup/docs/pdds/pdd28_strings.pod
==============================================================================
--- branches/html_cleanup/docs/pdds/pdd28_strings.pod Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/docs/pdds/pdd28_strings.pod Sun Oct 24 12:14:32 2010 (r49645)
@@ -403,6 +403,10 @@
of the string). Combining characters are counted separately. Variable-width
encodings will lookahead to capture full character values.
+=head4 Parrot_str_chr (was string_chr)
+
+Returns a single character string from a codepoint.
+
=head4 Parrot_str_grapheme_indexed
Returns the grapheme at the given index (the Nth grapheme from the string's
@@ -554,8 +558,7 @@
=head4 string_chr
-This is handled just fine by C<Parrot_str_new>, we don't need a special
-version for a single character.
+Replaced by C<Parrot_str_chr>.
=head4 make_writable
@@ -758,9 +761,7 @@
=item reverse
-Reverse a string, one grapheme at a time. {{ NOTE: Currently only works for
-ASCII strings, because it reverses one C<char> at a time. }}
-
+Reverse a string, one grapheme at a time.
=item is_integer
Modified: branches/html_cleanup/docs/project/release_manager_guide.pod
==============================================================================
--- branches/html_cleanup/docs/project/release_manager_guide.pod Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/docs/project/release_manager_guide.pod Sun Oct 24 12:14:32 2010 (r49645)
@@ -407,7 +407,6 @@
visible at
L<http://www.google.com/calendar/render?cid=ldhctdamsgfg5a1cord52po9h8@group.calendar.google.com>.
- - Oct 19, 2010 - 2.9* - gerd
- Nov 16, 2010 - 2.10 - tcurtis
- Dec 21, 2010 - 2.11 - whiteknight
- Jan 18, 2011 - 3.0* - cotto
Modified: branches/html_cleanup/include/parrot/encoding.h
==============================================================================
--- branches/html_cleanup/include/parrot/encoding.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/encoding.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -25,6 +25,10 @@
PARROT_DATA STR_VTABLE *Parrot_default_encoding_ptr;
+#ifdef PARROT_IN_CORE
+PARROT_DATA STR_VTABLE *Parrot_null_encoding_ptr;
+#endif
+
/* HEADERIZER BEGIN: src/string/encoding.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
Modified: branches/html_cleanup/include/parrot/extend.h
==============================================================================
--- branches/html_cleanup/include/parrot/extend.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/extend.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -151,6 +151,10 @@
__attribute__nonnull__(1);
PARROT_EXPORT
+void Parrot_register_string(PARROT_INTERP, Parrot_String s)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
void Parrot_set_intreg(PARROT_INTERP, Parrot_Int regnum, Parrot_Int value)
__attribute__nonnull__(1);
@@ -181,6 +185,10 @@
__attribute__nonnull__(1);
PARROT_EXPORT
+void Parrot_unregister_string(PARROT_INTERP, Parrot_String s)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
int Parrot_vfprintf(PARROT_INTERP,
ARGIN(Parrot_PMC pio),
ARGIN(const char *s),
@@ -224,6 +232,8 @@
PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_register_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_register_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_set_intreg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_set_numreg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -238,6 +248,8 @@
, PARROT_ASSERT_ARG(signature))
#define ASSERT_ARGS_Parrot_unregister_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_unregister_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_vfprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pio) \
Modified: branches/html_cleanup/include/parrot/hash.h
==============================================================================
--- branches/html_cleanup/include/parrot/hash.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/hash.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -34,7 +34,7 @@
Hash_key_type_PMC,
Hash_key_type_ptr,
Hash_key_type_PMC_ptr,
- Hash_key_type_STRING_enc,
+ Hash_key_type_STRING_enc
} Hash_key_type;
/* &end_gen */
Modified: branches/html_cleanup/include/parrot/imageio.h
==============================================================================
--- branches/html_cleanup/include/parrot/imageio.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/imageio.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -20,7 +20,7 @@
enum {
enum_PackID_normal = 0,
- enum_PackID_seen = 1,
+ enum_PackID_seen = 1
};
#endif /* PARROT_IMAGEIO_H_GUARD */
Modified: branches/html_cleanup/include/parrot/list.h
==============================================================================
--- branches/html_cleanup/include/parrot/list.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/list.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -126,11 +126,13 @@
struct Linked_List* Parrot_list_new(SHIM_INTERP);
PARROT_EXPORT
+PARROT_CAN_RETURN_NULL
List_Item_Header* Parrot_list_pop(PARROT_INTERP, ARGIN(Linked_List *list))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_EXPORT
+PARROT_CAN_RETURN_NULL
List_Item_Header* Parrot_list_remove(SHIM_INTERP,
ARGMOD(Linked_List *list),
ARGMOD(List_Item_Header *item))
Modified: branches/html_cleanup/include/parrot/memory.h
==============================================================================
--- branches/html_cleanup/include/parrot/memory.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/memory.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -76,12 +76,12 @@
PARROT_EXPORT
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
void * mem_sys_allocate(size_t size);
PARROT_EXPORT
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
void * mem_sys_allocate_zeroed(size_t size);
PARROT_EXPORT
@@ -89,12 +89,12 @@
PARROT_EXPORT
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
void * mem_sys_realloc(ARGFREE(void *from), size_t size);
PARROT_EXPORT
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
void * mem_sys_realloc_zeroed(
ARGFREE(void *from),
size_t size,
Modified: branches/html_cleanup/include/parrot/oplib/core_ops.h
==============================================================================
--- branches/html_cleanup/include/parrot/oplib/core_ops.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/oplib/core_ops.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -12,7 +12,7 @@
* .ops files). by ops2c.nqp.
*
* Any changes made here will be lost! To regenerate this file after making
- * changes to any ops, use the bootstap-ops makefile target.
+ * changes to any ops, use the bootstrap-ops makefile target.
*
*/
@@ -21,7 +21,7 @@
#include "parrot/runcore_api.h"
PARROT_EXPORT
-op_lib_t *Parrot_DynOp_core_2_8_0(PARROT_INTERP, long init);
+op_lib_t *Parrot_DynOp_core_2_9_1(PARROT_INTERP, long init);
opcode_t * Parrot_end(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_noop(opcode_t *, PARROT_INTERP);
Modified: branches/html_cleanup/include/parrot/oplib/ops.h
==============================================================================
--- branches/html_cleanup/include/parrot/oplib/ops.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/oplib/ops.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -12,7 +12,7 @@
* .ops files). by ops2c.nqp.
*
* Any changes made here will be lost! To regenerate this file after making
- * changes to any ops, use the bootstap-ops makefile target.
+ * changes to any ops, use the bootstrap-ops makefile target.
*
*/
Modified: branches/html_cleanup/include/parrot/opsenum.h
==============================================================================
--- branches/html_cleanup/include/parrot/opsenum.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/opsenum.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -12,7 +12,7 @@
* .ops files). by ops2c.nqp.
*
* Any changes made here will be lost! To regenerate this file after making
- * changes to any ops, use the bootstap-ops makefile target.
+ * changes to any ops, use the bootstrap-ops makefile target.
*
*/
enum OPS_ENUM {
Modified: branches/html_cleanup/include/parrot/runcore_api.h
==============================================================================
--- branches/html_cleanup/include/parrot/runcore_api.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/runcore_api.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -37,7 +37,7 @@
typedef enum Parrot_runcore_flags {
RUNCORE_REENTRANT_FLAG = 1 << 0,
- RUNCORE_FUNC_TABLE_FLAG = 1 << 1,
+ RUNCORE_FUNC_TABLE_FLAG = 1 << 1
} Parrot_runcore_flags;
Modified: branches/html_cleanup/include/parrot/runcore_profiling.h
==============================================================================
--- branches/html_cleanup/include/parrot/runcore_profiling.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/runcore_profiling.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -88,7 +88,6 @@
STRING *profile_filename;
PMC *prev_sub;
Parrot_Context *prev_ctx;
- UINTVAL level; /* how many nested runloops */
UINTVAL time_size; /* how big is the following array */
UHUGEINTVAL *time; /* time spent between DO_OP and start/end of a runcore */
Hash *line_cache; /* hash for caching pc -> line mapping */
Modified: branches/html_cleanup/include/parrot/string.h
==============================================================================
--- branches/html_cleanup/include/parrot/string.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/string.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -90,14 +90,14 @@
typedef INTVAL (*str_vtable_equal_t)(PARROT_INTERP, ARGIN(const STRING *lhs), ARGIN(const STRING *rhs));
typedef INTVAL (*str_vtable_compare_t)(PARROT_INTERP, ARGIN(const STRING *lhs), ARGIN(const STRING *rhs));
-typedef INTVAL (*str_vtable_index_t)(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search_string), UINTVAL offset);
-typedef INTVAL (*str_vtable_rindex_t)(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search_string), UINTVAL offset);
+typedef INTVAL (*str_vtable_index_t)(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search_string), INTVAL offset);
+typedef INTVAL (*str_vtable_rindex_t)(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search_string), INTVAL offset);
typedef size_t (*str_vtable_hash_t)(PARROT_INTERP, ARGIN(const STRING *s), size_t hashval);
typedef UINTVAL (*str_vtable_validate_t)(PARROT_INTERP, ARGIN(const STRING *src));
typedef UINTVAL (*str_vtable_scan_t)(PARROT_INTERP, ARGIN(const STRING *src));
-typedef UINTVAL (*str_vtable_ord_t)(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset);
-typedef STRING * (*str_vtable_substr_t)(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count);
+typedef UINTVAL (*str_vtable_ord_t)(PARROT_INTERP, ARGIN(const STRING *src), INTVAL offset);
+typedef STRING * (*str_vtable_substr_t)(PARROT_INTERP, ARGIN(const STRING *src), INTVAL offset, INTVAL count);
/* character classes */
typedef INTVAL (*str_vtable_is_cclass_t)(PARROT_INTERP, INTVAL, ARGIN(const STRING *src), UINTVAL offset);
Modified: branches/html_cleanup/include/parrot/string_funcs.h
==============================================================================
--- branches/html_cleanup/include/parrot/string_funcs.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/string_funcs.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -87,6 +87,12 @@
__attribute__nonnull__(2);
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
+STRING * Parrot_str_chr(PARROT_INTERP, UINTVAL character)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL Parrot_str_compare(PARROT_INTERP,
ARGIN_NULLOK(const STRING *s1),
@@ -156,8 +162,8 @@
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL Parrot_str_find_index(PARROT_INTERP,
- ARGIN(const STRING *s),
- ARGIN(const STRING *s2),
+ ARGIN(const STRING *src),
+ ARGIN(const STRING *search),
INTVAL start)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
@@ -200,10 +206,18 @@
__attribute__nonnull__(1);
PARROT_EXPORT
+void Parrot_str_gc_register(PARROT_INTERP, ARGIN(STRING *s))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+void Parrot_str_gc_unregister(PARROT_INTERP, ARGIN(STRING *s))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
-INTVAL Parrot_str_indexed(PARROT_INTERP,
- ARGIN(const STRING *s),
- UINTVAL idx)
+INTVAL Parrot_str_indexed(PARROT_INTERP, ARGIN(const STRING *s), INTVAL idx)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -226,31 +240,6 @@
INTVAL Parrot_str_is_null(SHIM_INTERP, ARGIN_NULLOK(const STRING *s));
PARROT_EXPORT
-INTVAL Parrot_str_iter_index(PARROT_INTERP,
- ARGIN(const STRING *src),
- ARGMOD(String_iter *start),
- ARGOUT(String_iter *end),
- ARGIN(const STRING *search))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- __attribute__nonnull__(4)
- __attribute__nonnull__(5)
- FUNC_MODIFIES(*start)
- FUNC_MODIFIES(*end);
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-STRING * Parrot_str_iter_substr(PARROT_INTERP,
- ARGIN(const STRING *str),
- ARGIN(const String_iter *l),
- ARGIN_NULLOK(const String_iter *r))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
STRING* Parrot_str_join(PARROT_INTERP,
@@ -350,6 +339,12 @@
__attribute__nonnull__(5);
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+STRING * Parrot_str_reverse(PARROT_INTERP, ARGIN(const STRING *src))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
PMC* Parrot_str_split(PARROT_INTERP,
@@ -380,9 +375,9 @@
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
-size_t Parrot_str_to_hashval(PARROT_INTERP, ARGMOD_NULLOK(STRING *s))
+size_t Parrot_str_to_hashval(PARROT_INTERP, ARGIN(const STRING *s))
__attribute__nonnull__(1)
- FUNC_MODIFIES(*s);
+ __attribute__nonnull__(2);
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
@@ -435,13 +430,6 @@
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
-STRING * string_increment(PARROT_INTERP, ARGIN(const STRING *s))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
STRING * string_make(PARROT_INTERP,
ARGIN_NULLOK(const char *buffer),
UINTVAL len,
@@ -451,12 +439,6 @@
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-INTVAL string_max_bytes(SHIM_INTERP, ARGIN(const STRING *s), UINTVAL nchars)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
INTVAL string_ord(PARROT_INTERP, ARGIN(const STRING *s), INTVAL idx)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -494,6 +476,29 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*tc);
+INTVAL Parrot_str_iter_index(PARROT_INTERP,
+ ARGIN(const STRING *src),
+ ARGMOD(String_iter *start),
+ ARGOUT(String_iter *end),
+ ARGIN(const STRING *search))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4)
+ __attribute__nonnull__(5)
+ FUNC_MODIFIES(*start)
+ FUNC_MODIFIES(*end);
+
+PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
+STRING * Parrot_str_iter_substr(PARROT_INTERP,
+ ARGIN(const STRING *str),
+ ARGIN(const String_iter *l),
+ ARGIN_NULLOK(const String_iter *r))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
#define ASSERT_ARGS_Parrot_str_bitwise_and __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_bitwise_not __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -512,6 +517,8 @@
#define ASSERT_ARGS_Parrot_str_chopn __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(s))
+#define ASSERT_ARGS_Parrot_str_chr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_compare __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_compose __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -535,8 +542,8 @@
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_find_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s) \
- , PARROT_ASSERT_ARG(s2))
+ , PARROT_ASSERT_ARG(src) \
+ , PARROT_ASSERT_ARG(search))
#define ASSERT_ARGS_Parrot_str_find_not_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_finish __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -549,6 +556,12 @@
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_from_num __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_str_gc_register __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(s))
+#define ASSERT_ARGS_Parrot_str_gc_unregister __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_indexed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(s))
@@ -558,16 +571,6 @@
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_is_null __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_Parrot_str_iter_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src) \
- , PARROT_ASSERT_ARG(start) \
- , PARROT_ASSERT_ARG(end) \
- , PARROT_ASSERT_ARG(search))
-#define ASSERT_ARGS_Parrot_str_iter_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
- , PARROT_ASSERT_ARG(l))
#define ASSERT_ARGS_Parrot_str_join __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ar))
@@ -600,6 +603,9 @@
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src) \
, PARROT_ASSERT_ARG(rep))
+#define ASSERT_ARGS_Parrot_str_reverse __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_Parrot_str_split __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -609,7 +615,8 @@
#define ASSERT_ARGS_Parrot_str_to_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_to_hashval __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_str_to_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_to_num __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -629,13 +636,8 @@
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_string_chr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_string_increment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_string_make __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_string_max_bytes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_string_ord __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(s))
@@ -649,6 +651,16 @@
#define ASSERT_ARGS_Parrot_str_from_uint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(tc))
+#define ASSERT_ARGS_Parrot_str_iter_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(src) \
+ , PARROT_ASSERT_ARG(start) \
+ , PARROT_ASSERT_ARG(end) \
+ , PARROT_ASSERT_ARG(search))
+#define ASSERT_ARGS_Parrot_str_iter_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(str) \
+ , PARROT_ASSERT_ARG(l))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/string/api.c */
Copied: branches/html_cleanup/include/parrot/sysmem.h (from r49644, trunk/include/parrot/sysmem.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/include/parrot/sysmem.h Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/include/parrot/sysmem.h)
@@ -0,0 +1,25 @@
+/* sysmem.h
+ * Copyright (C) 2010, Parrot Foundation.
+ *
+ * SVN Info
+ * $Id$
+ *
+ * This is the api header for abstracting sysmem calls
+ */
+
+#ifndef PARROT_SYSMEM_H_GUARD
+#define PARROT_SYSMEM_H_GUARD
+
+#include "parrot/config.h"
+
+PARROT_EXPORT size_t Parrot_sysmem_amount(Parrot_Interp);
+
+#endif /* PARROT_SYSMEM_H_GUARD */
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
+
Modified: branches/html_cleanup/include/parrot/thr_windows.h
==============================================================================
--- branches/html_cleanup/include/parrot/thr_windows.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/thr_windows.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -119,13 +119,12 @@
typedef void (*Cleanup_Handler)(void *);
-#ifndef _TIMESPEC_DEFINED
-# define _TIMESPEC_DEFINED
+#ifndef PARROT_HAS_TIMESPEC
struct timespec {
time_t tv_sec;
long tv_nsec;
};
-#endif /* _TIMESPEC_DEFINED */
+#endif /* PARROT_HAS_TIMESPEC */
#endif /* PARROT_THR_WINDOWS_H_GUARD */
Modified: branches/html_cleanup/include/parrot/thread.h
==============================================================================
--- branches/html_cleanup/include/parrot/thread.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/include/parrot/thread.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -46,13 +46,12 @@
typedef void (*Cleanup_Handler)(void *);
-# ifndef __timespec_defined
-# define __timespec_defined
+# if ! PARROT_HAS_TIMESPEC
struct timespec {
time_t tv_sec;
long tv_nsec;
};
-# endif /* __timespec_defined */
+# endif /* PARROT_HAS_TIMESPEC */
#endif /* PARROT_HAS_THREADS */
Modified: branches/html_cleanup/lib/Parrot/Configure/Options/Conf.pm
==============================================================================
--- branches/html_cleanup/lib/Parrot/Configure/Options/Conf.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/lib/Parrot/Configure/Options/Conf.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -72,6 +72,8 @@
--libs=(libs) Use the given libraries
--link=(linker) Use the given linker
--linkflags=(flags) Use the given linker flags
+ --ar=(archiver) Use the given librarian for static libraries
+ --arflags=(flags) Use the given flags for static libraries
--ld=(linker) Use the given loader for shared libraries
--ldflags=(flags) Use the given loader flags for shared libraries
--lex=(lexer) Use the given lexical analyzer generator
Modified: branches/html_cleanup/lib/Parrot/Configure/Options/Conf/Shared.pm
==============================================================================
--- branches/html_cleanup/lib/Parrot/Configure/Options/Conf/Shared.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/lib/Parrot/Configure/Options/Conf/Shared.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -10,6 +10,8 @@
);
our @shared_valid_options = qw{
+ ar
+ arflags
bindir
cage
cc
Modified: branches/html_cleanup/lib/Parrot/Configure/Options/Test.pm
==============================================================================
--- branches/html_cleanup/lib/Parrot/Configure/Options/Test.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/lib/Parrot/Configure/Options/Test.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -7,6 +7,7 @@
use Test::Harness;
use lib qw(lib);
use Parrot::Configure::Step::List qw( get_steps_list );
+use Parrot::Configure::Options::Test::Prepare qw( get_steps_missing_tests );
sub new {
my ( $class, $argsref ) = @_;
@@ -95,7 +96,7 @@
TEST
my $end =time();
print scalar(@preconfiguration_tests),
- " t/configure and t/step tests took ",
+ " t/configure tests took ",
($end - $start), " seconds.\n";
}
return 1;
@@ -105,10 +106,20 @@
my $self = shift;
my @postconfiguration_tests = @_;
if ( $self->get_run('run_build_tests') ) {
+ my $start = time();
print "\n\n";
print "As you requested, I will now run some tests of the build tools.\n\n";
+ my @steps_missing_tests = get_steps_missing_tests();
+ if (@steps_missing_tests) {
+ print "The following configuration steps lack corresponding tests:\n";
+ print " $_\n" for @steps_missing_tests;
+ }
runtests(@postconfiguration_tests) or die
"Post-configuration and build tools tests did not complete successfully; running 'make' might be dubious.";
+ my $end =time();
+ print scalar(@postconfiguration_tests),
+ " t/steps, t/postconfigure and t/pharness tests took ",
+ ($end - $start), " seconds.\n";
}
return 1;
}
Modified: branches/html_cleanup/lib/Parrot/Configure/Options/Test/Prepare.pm
==============================================================================
--- branches/html_cleanup/lib/Parrot/Configure/Options/Test/Prepare.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/lib/Parrot/Configure/Options/Test/Prepare.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -4,13 +4,12 @@
use strict;
use warnings;
use Carp;
-use Data::Dumper;$Data::Dumper::Indent=1;
use File::Find;
-#use Scalar::Util qw( looks_like_number );
use base qw( Exporter );
our @EXPORT_OK = qw(
get_preconfiguration_tests
get_postconfiguration_tests
+ get_steps_missing_tests
);
use lib qw(lib);
use Parrot::Configure::Step::List qw( get_steps_list );
@@ -22,7 +21,7 @@
my ( $steps_tests_simple_ref, $steps_tests_complex_ref ) =
_find_steps_tests($steps_dir);
my @steps_expected = get_steps_list();
-my @steps_tests = _prepare_steps_tests_list(
+my ($steps_tests_ref, $steps_missing_tests_ref) = _prepare_steps_tests_list(
$steps_dir,
$steps_tests_complex_ref,
\@steps_expected,
@@ -34,13 +33,17 @@
sub get_postconfiguration_tests {
my @postconfiguration_tests = (
- @steps_tests,
+ @{$steps_tests_ref},
glob("t/postconfigure/*.t"),
glob("t/pharness/*.t"),
);
return @postconfiguration_tests;
};
+sub get_steps_missing_tests {
+ return @{$steps_missing_tests_ref};
+}
+
########## INTERNAL SUBROUTINES ##########
sub _get_framework_tests {
@@ -58,6 +61,8 @@
my %steps_tests_complex = ();
sub _find_steps_tests {
my $steps_dir = shift;
+ %steps_tests_simple = ();
+ %steps_tests_complex = ();
sub wanted {
if ( $File::Find::name =~
m<
@@ -87,16 +92,14 @@
}
sub _prepare_steps_tests_list {
- my $steps_dir = shift;
- my $steps_tests_ref = shift;
- my $steps_expected_ref = shift;
- my @steps_tests;
+ my ($steps_dir, $steps_tests_ref, $steps_expected_ref) = @_;
+ my (@steps_tests, @steps_lacking_tests);
# The order of tests of config steps is governed by
# Parrot::Configure::Step::List::get_steps_list().
foreach my $step ( @{ $steps_expected_ref } ) {
my @module_path = split /::/, $step;
my $these_tests = $steps_tests_ref->{$module_path[0]}{$module_path[1]}
- or carp "No tests exist for configure step $step";
+ or push @steps_lacking_tests, $step;
foreach my $k (sort keys %$these_tests) {
if ( $k =~ m/^(\w+)-(\d{2})$/ ) {
my ($secondlevel, $number) = ($1, $2);
@@ -109,7 +112,7 @@
}
}
}
- return @steps_tests;
+ return (\@steps_tests, \@steps_lacking_tests);
}
1;
@@ -132,6 +135,7 @@
use Parrot::Configure::Options::Test::Prepare qw(
get_preconfiguration_tests
get_postconfiguration_tests
+ get_steps_missing_tests
);
...
@@ -163,6 +167,12 @@
t/tools/pmc2cutils/
t/pharness/
+=item * C<get_steps_missing_tests()>
+
+Returns a list of those configuration steps (in format like, I<e.g.,>
+C<auto::stat>) those configuration steps currently lacking tests in
+F<t/steps/>.
+
=back
=head1 AUTHOR
Modified: branches/html_cleanup/lib/Parrot/Configure/Step/List.pm
==============================================================================
--- branches/html_cleanup/lib/Parrot/Configure/Step/List.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/lib/Parrot/Configure/Step/List.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -45,8 +45,10 @@
auto::memalign
auto::signal
auto::socklen_t
+ auto::stat
auto::neg_0
auto::env
+ auto::timespec
auto::thread
auto::gmp
auto::readline
@@ -60,6 +62,7 @@
auto::ctags
auto::revision
auto::icu
+ auto::ipv6
gen::config_h
gen::core_pmcs
gen::opengl
Modified: branches/html_cleanup/lib/Parrot/Pmc2c/PMC.pm
==============================================================================
--- branches/html_cleanup/lib/Parrot/Pmc2c/PMC.pm Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/lib/Parrot/Pmc2c/PMC.pm Sun Oct 24 12:14:32 2010 (r49645)
@@ -71,7 +71,7 @@
# methods
sub add_method {
my ( $self, $method ) = @_;
- warn "FATAL ERROR: Duplicated VTABLE function: " . $method->name
+ die "FATAL ERROR: Duplicated VTABLE function: " . $method->name
if exists $self->{has_method}{$method->name};
$self->{has_method}{ $method->name } = @{ $self->{methods} };
push @{ $self->{methods} }, $method;
Modified: branches/html_cleanup/ports/debian/parrot-devel.install.in
==============================================================================
--- branches/html_cleanup/ports/debian/parrot-devel.install.in Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/ports/debian/parrot-devel.install.in Sun Oct 24 12:14:32 2010 (r49645)
@@ -8,6 +8,7 @@
usr/bin/parrot-nqp
usr/lib/parrot/@VERSION@/tools/*
usr/lib/parrot/@VERSION@/languages/pct/*
+usr/lib/parrot/@VERSION@/library/distutils.pbc
usr/lib/parrot/@VERSION@/library/HLL.pbc
usr/lib/parrot/@VERSION@/library/Regex.pbc
usr/lib/parrot/@VERSION@/library/P6Regex.pbc
Modified: branches/html_cleanup/src/call/pcc.c
==============================================================================
--- branches/html_cleanup/src/call/pcc.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/call/pcc.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -309,7 +309,7 @@
Parrot_pcc_set_signature(interp, ctx, call_object);
Parrot_pcc_set_continuation(interp, ctx, ret_cont);
- interp->current_cont = NEED_CONTINUATION;
+ interp->current_cont = NEED_CONTINUATION;
PARROT_CONTINUATION(ret_cont)->from_ctx = ctx;
/* Invoke the function */
Modified: branches/html_cleanup/src/debug.c
==============================================================================
--- branches/html_cleanup/src/debug.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/debug.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -1990,17 +1990,17 @@
n = REG_STR(interp, *(int *)condition->value);
if (((condition->type & PDB_cond_gt) &&
- (Parrot_str_compare(interp, m, n) > 0)) ||
+ (STRING_compare(interp, m, n) > 0)) ||
((condition->type & PDB_cond_ge) &&
- (Parrot_str_compare(interp, m, n) >= 0)) ||
+ (STRING_compare(interp, m, n) >= 0)) ||
((condition->type & PDB_cond_eq) &&
- (Parrot_str_compare(interp, m, n) == 0)) ||
+ (STRING_compare(interp, m, n) == 0)) ||
((condition->type & PDB_cond_ne) &&
- (Parrot_str_compare(interp, m, n) != 0)) ||
+ (STRING_compare(interp, m, n) != 0)) ||
((condition->type & PDB_cond_le) &&
- (Parrot_str_compare(interp, m, n) <= 0)) ||
+ (STRING_compare(interp, m, n) <= 0)) ||
((condition->type & PDB_cond_lt) &&
- (Parrot_str_compare(interp, m, n) < 0)))
+ (STRING_compare(interp, m, n) < 0)))
return 1;
return 0;
@@ -2350,12 +2350,19 @@
case PARROT_ARG_SC:
{
const STRING *s = interp->code->const_table->str.constants[op[j]];
+
+ if (s->encoding != Parrot_ascii_encoding_ptr) {
+ strcpy(&dest[size], s->encoding->name);
+ size += strlen(s->encoding->name);
+ dest[size++] = ':';
+ }
+
dest[size++] = '"';
if (s->strlen) {
char * const unescaped =
Parrot_str_to_cstring(interp, s);
char * const escaped =
- PDB_escape(interp, unescaped, s->strlen);
+ PDB_escape(interp, unescaped, s->bufused);
if (escaped) {
strcpy(&dest[size], escaped);
size += strlen(escaped);
Modified: branches/html_cleanup/src/dynext.c
==============================================================================
--- branches/html_cleanup/src/dynext.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/dynext.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -51,14 +51,16 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static STRING * get_path(PARROT_INTERP,
- ARGMOD_NULLOK(STRING *lib),
+ ARGMOD(STRING *lib),
Parrot_dlopen_flags flags,
ARGOUT(void **handle),
ARGIN(STRING *wo_ext),
- ARGIN_NULLOK(STRING *ext))
+ ARGIN(STRING *ext))
__attribute__nonnull__(1)
+ __attribute__nonnull__(2)
__attribute__nonnull__(4)
__attribute__nonnull__(5)
+ __attribute__nonnull__(6)
FUNC_MODIFIES(*lib)
FUNC_MODIFIES(*handle);
@@ -77,10 +79,11 @@
PARROT_CANNOT_RETURN_NULL
static PMC * run_init_lib(PARROT_INTERP,
ARGIN(void *handle),
- ARGIN_NULLOK(STRING *lib_name),
+ ARGIN(STRING *lib_name),
ARGIN(STRING *wo_ext))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
+ __attribute__nonnull__(3)
__attribute__nonnull__(4);
static void set_cstring_prop(PARROT_INTERP,
@@ -97,11 +100,12 @@
ARGIN(PMC *lib_pmc),
ARGIN(STRING *path),
ARGIN(STRING *type),
- ARGIN_NULLOK(STRING *lib_name))
+ ARGIN(STRING *lib_name))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4);
+ __attribute__nonnull__(4)
+ __attribute__nonnull__(5);
#define ASSERT_ARGS_clone_string_into __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(d) \
@@ -112,8 +116,10 @@
, PARROT_ASSERT_ARG(path))
#define ASSERT_ARGS_get_path __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(lib) \
, PARROT_ASSERT_ARG(handle) \
- , PARROT_ASSERT_ARG(wo_ext))
+ , PARROT_ASSERT_ARG(wo_ext) \
+ , PARROT_ASSERT_ARG(ext))
#define ASSERT_ARGS_is_loaded __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(path))
@@ -123,6 +129,7 @@
#define ASSERT_ARGS_run_init_lib __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle) \
+ , PARROT_ASSERT_ARG(lib_name) \
, PARROT_ASSERT_ARG(wo_ext))
#define ASSERT_ARGS_set_cstring_prop __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -133,7 +140,8 @@
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(lib_pmc) \
, PARROT_ASSERT_ARG(path) \
- , PARROT_ASSERT_ARG(type))
+ , PARROT_ASSERT_ARG(type) \
+ , PARROT_ASSERT_ARG(lib_name))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -177,7 +185,7 @@
static void
store_lib_pmc(PARROT_INTERP, ARGIN(PMC *lib_pmc), ARGIN(STRING *path),
- ARGIN(STRING *type), ARGIN_NULLOK(STRING *lib_name))
+ ARGIN(STRING *type), ARGIN(STRING *lib_name))
{
ASSERT_ARGS(store_lib_pmc)
PMC * const iglobals = interp->iglobals;
@@ -188,7 +196,7 @@
set_cstring_prop(interp, lib_pmc, "_filename", path);
set_cstring_prop(interp, lib_pmc, "_type", type);
- if (lib_name)
+ if (!STRING_IS_NULL(lib_name))
set_cstring_prop(interp, lib_pmc, "_lib_name", lib_name);
VTABLE_set_pmc_keyed_str(interp, dyn_libs, path, lib_pmc);
@@ -260,9 +268,8 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static STRING *
-get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
- ARGOUT(void **handle), ARGIN(STRING *wo_ext),
- ARGIN_NULLOK(STRING *ext))
+get_path(PARROT_INTERP, ARGMOD(STRING *lib), Parrot_dlopen_flags flags,
+ ARGOUT(void **handle), ARGIN(STRING *wo_ext), ARGIN(STRING *ext))
{
ASSERT_ARGS(get_path)
PMC * const iglobals = interp->iglobals;
@@ -273,7 +280,7 @@
STRING *path, *full_name;
- if (! lib) {
+ if (STRING_IS_NULL(lib)) {
*handle = Parrot_dlopen((char *)NULL, flags);
if (*handle)
return CONST_STRING(interp, "");
@@ -284,12 +291,12 @@
err ? err : "unknown reason");
/* clear the error memory */
(void)Parrot_dlerror();
- return NULL;
+ return STRINGNULL;
}
}
/* first, try to add an extension to the file if it has none */
- if (! ext) {
+ if (STRING_IS_NULL(ext)) {
const INTVAL n = VTABLE_elements(interp, share_ext);
INTVAL i;
@@ -299,7 +306,7 @@
path = Parrot_locate_runtime_file_str(interp, full_name,
PARROT_RUNTIME_FT_DYNEXT);
- if (path) {
+ if (!STRING_IS_NULL(path)) {
*handle = dlopen_string(interp, flags, path);
if (*handle)
@@ -311,7 +318,7 @@
full_name, err ? err : "unknown reason");
/* clear the error memory */
(void)Parrot_dlerror();
- return NULL;
+ return STRINGNULL;
}
}
@@ -332,7 +339,7 @@
full_name = Parrot_locate_runtime_file_str(interp, lib,
PARROT_RUNTIME_FT_DYNEXT);
- if (full_name) {
+ if (!STRING_IS_NULL(full_name)) {
*handle = dlopen_string(interp, flags, full_name);
if (*handle)
@@ -344,19 +351,19 @@
* [shouldn't this happen in Parrot_locate_runtime_file instead?]
*/
#ifdef WIN32
- if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
+ if (STRING_length(lib) >= 3 && memcmp(lib->strstart, "lib", 3) == 0) {
*handle = Parrot_dlopen((char *)lib->strstart + 3, 0);
if (*handle)
- return Parrot_str_substr(interp, lib, 3, lib->strlen - 3);
+ return STRING_substr(interp, lib, 3, lib->strlen - 3);
}
#endif
/* And on cygwin replace a leading "lib" by "cyg". */
#ifdef __CYGWIN__
- if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
+ if (!STRING_length(lib) >= 3 && memcmp(lib->strstart, "lib", 3) == 0) {
path = Parrot_str_concat(interp, CONST_STRING(interp, "cyg"),
- Parrot_str_substr(interp, lib, 3, lib->strlen - 3));
+ STRING_substr(interp, lib, 3, lib->strlen - 3));
*handle = dlopen_string(interp, flags, path);
@@ -365,7 +372,7 @@
}
#endif
- if (STRING_IS_EMPTY(lib)) {
+ if (!STRING_length(lib)) {
*handle = dlopen_string(interp, flags, lib);
if (*handle)
return lib;
@@ -379,7 +386,7 @@
/* clear the error memory */
(void)Parrot_dlerror();
- return NULL;
+ return STRINGNULL;
}
}
@@ -469,7 +476,7 @@
PARROT_CANNOT_RETURN_NULL
static PMC *
run_init_lib(PARROT_INTERP, ARGIN(void *handle),
- ARGIN_NULLOK(STRING *lib_name), ARGIN(STRING *wo_ext))
+ ARGIN(STRING *lib_name), ARGIN(STRING *wo_ext))
{
ASSERT_ARGS(run_init_lib)
STRING *type;
@@ -484,7 +491,7 @@
Parrot_pcc_set_namespace(interp, context,
Parrot_get_HLL_namespace(interp, parrot_hll_id));
- if (lib_name) {
+ if (!STRING_IS_NULL(lib_name)) {
STRING * const load_name = Parrot_sprintf_c(interp,
"Parrot_lib_%Ss_load", lib_name);
STRING * const init_func_name = Parrot_sprintf_c(interp,
@@ -606,7 +613,7 @@
STRING * const type =
VTABLE_get_string(s, VTABLE_getprop(s, lib_pmc, type_str));
- if (Parrot_str_equal(s, type, ops)) {
+ if (STRING_equal(s, type, ops)) {
/* we can't clone oplibs in the normal way, since they're actually
* shared between interpreters dynop_register modifies the (statically
* allocated) op_lib_t structure from core_ops.c, for example.
@@ -690,12 +697,12 @@
*
* LOCK()
*/
- if (lib)
+ if (!STRING_IS_NULL(lib))
lib_name = parrot_split_path_ext(interp, lib, &wo_ext, &ext);
else {
wo_ext = CONST_STRING(interp, "");
- lib_name = NULL;
- ext = NULL;
+ lib_name = STRINGNULL;
+ ext = STRINGNULL;
}
lib_pmc = is_loaded(interp, wo_ext);
Modified: branches/html_cleanup/src/dynpmc/os.pmc
==============================================================================
--- branches/html_cleanup/src/dynpmc/os.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/dynpmc/os.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -506,11 +506,8 @@
HANDLE hFind = INVALID_HANDLE_VALUE;
/* Add \* to the directory name and start search. */
- STRING *last_char = Parrot_str_substr(INTERP, path,
- Parrot_str_length(INTERP, path) - 1, 1, NULL, 0);
- int trailing_slash = Parrot_str_equal(INTERP, last_char, string_from_literal(INTERP, "\\"))
- ||
- Parrot_str_equal(INTERP, last_char, string_from_literal(INTERP, "/"));
+ INTVAL last_char = STRING_ord(INTERP, path, -1);
+ int trailing_slash = last_char == '\\' || last_char == '/';
cpath = Parrot_str_to_cstring(INTERP, Parrot_str_concat(INTERP,
path, string_from_literal(INTERP, trailing_slash ? "*" : "\\*"), 0));
hFind = FindFirstFile(cpath, &file_find_data);
Modified: branches/html_cleanup/src/embed.c
==============================================================================
--- branches/html_cleanup/src/embed.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/embed.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -1118,10 +1118,10 @@
PARROT_ASSERT(interp->initial_pf);
}
- if (Parrot_str_compare(interp, CONST_STRING(interp, "PIR"), type) == 0)
+ if (STRING_equal(interp, CONST_STRING(interp, "PIR"), type))
return IMCC_compile_pir_s(interp, code, error);
- if (Parrot_str_compare(interp, CONST_STRING(interp, "PASM"), type) == 0)
+ if (STRING_equal(interp, CONST_STRING(interp, "PASM"), type))
return IMCC_compile_pasm_s(interp, code, error);
*error = Parrot_str_new(interp, "Invalid interpreter type", 0);
Modified: branches/html_cleanup/src/exceptions.c
==============================================================================
--- branches/html_cleanup/src/exceptions.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/exceptions.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -131,7 +131,7 @@
}
}
- if (Parrot_str_not_equal(interp, message, CONST_STRING(interp, ""))) {
+ if (STRING_length(message)) {
if (use_perr)
Parrot_io_eprintf(interp, "%S\n", message);
else {
@@ -234,7 +234,7 @@
const INTVAL severity = VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "severity"));
if (severity < EXCEPT_error) {
PMC * const resume = VTABLE_get_attr_str(interp, exception, CONST_STRING(interp, "resume"));
- if (Parrot_str_not_equal(interp, message, CONST_STRING(interp, ""))) {
+ if (STRING_length(message)) {
Parrot_io_eprintf(interp, "%S\n", message);
}
else {
Modified: branches/html_cleanup/src/extend.c
==============================================================================
--- branches/html_cleanup/src/extend.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/extend.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -511,8 +511,21 @@
{
ASSERT_ARGS(Parrot_new_string)
Parrot_String retval;
+ const STR_VTABLE *encoding;
+
PARROT_CALLIN_START(interp);
- retval = string_make(interp, buffer, length, encoding_name, flags);
+
+ if (encoding_name) {
+ encoding = Parrot_find_encoding(interp, encoding_name);
+ if (!encoding)
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Can't make '%s' encoding strings", encoding_name);
+ }
+ else
+ encoding = Parrot_default_encoding_ptr;
+
+ retval = Parrot_str_new_init(interp, buffer, length, encoding, flags);
+
PARROT_CALLIN_END(interp);
return retval;
}
@@ -582,6 +595,49 @@
/*
+=item C<void Parrot_register_string(PARROT_INTERP, Parrot_String s)>
+
+Add a reference of the string to the interpreter's GC registry. This prevents
+strings only known to extension from getting destroyed during GC runs.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_register_string(PARROT_INTERP, Parrot_String s)
+{
+ ASSERT_ARGS(Parrot_register_string)
+ PARROT_CALLIN_START(interp);
+ Parrot_str_gc_register(interp, s);
+ PARROT_CALLIN_END(interp);
+}
+
+/*
+
+=item C<void Parrot_unregister_string(PARROT_INTERP, Parrot_String s)>
+
+Remove a reference of the string from the interpreter's GC registry. If the
+reference count reaches zero, the string will be destroyed during the next GC
+run.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_unregister_string(PARROT_INTERP, Parrot_String s)
+{
+ ASSERT_ARGS(Parrot_unregister_string)
+ PARROT_CALLIN_START(interp);
+ Parrot_str_gc_unregister(interp, s);
+ PARROT_CALLIN_END(interp);
+}
+
+/*
+
=item C<Parrot_PMC Parrot_sub_new_from_c_func(PARROT_INTERP, void (*func(void)),
const char * signature)>
Modified: branches/html_cleanup/src/gc/alloc_memory.c
==============================================================================
--- branches/html_cleanup/src/gc/alloc_memory.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/gc/alloc_memory.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -48,7 +48,7 @@
PARROT_EXPORT
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
void *
mem_sys_allocate(size_t size)
{
@@ -57,7 +57,7 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
@@ -75,7 +75,7 @@
PARROT_EXPORT
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
void *
mem_sys_allocate_zeroed(size_t size)
{
@@ -84,7 +84,7 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
@@ -103,7 +103,7 @@
PARROT_EXPORT
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
void *
mem_sys_realloc(ARGFREE(void *from), size_t size)
{
@@ -119,7 +119,7 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
@@ -139,7 +139,7 @@
PARROT_EXPORT
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
void *
mem_sys_realloc_zeroed(ARGFREE(void *from), size_t size, size_t old_size)
{
@@ -152,7 +152,7 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
if (size > old_size)
Modified: branches/html_cleanup/src/gc/gc_inf.c
==============================================================================
--- branches/html_cleanup/src/gc/gc_inf.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/gc/gc_inf.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -57,11 +57,11 @@
static void* gc_inf_allocate_fixed_size_storage(SHIM_INTERP, size_t size);
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void * gc_inf_allocate_memory_chunk(SHIM_INTERP, size_t size);
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void * gc_inf_allocate_memory_chunk_zeroed(SHIM_INTERP, size_t size);
PARROT_MALLOC
@@ -112,7 +112,7 @@
FUNC_MODIFIES(*buffer);
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void * gc_inf_reallocate_memory_chunk(SHIM_INTERP,
ARGFREE(void *from),
size_t size);
@@ -509,7 +509,7 @@
*/
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void *
gc_inf_allocate_memory_chunk(SHIM_INTERP, size_t size)
{
@@ -518,13 +518,13 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void *
gc_inf_reallocate_memory_chunk(SHIM_INTERP, ARGFREE(void *from), size_t size)
{
@@ -540,13 +540,13 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void *
gc_inf_allocate_memory_chunk_zeroed(SHIM_INTERP, size_t size)
{
@@ -555,7 +555,7 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
Modified: branches/html_cleanup/src/gc/gc_ms.c
==============================================================================
--- branches/html_cleanup/src/gc/gc_ms.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/gc/gc_ms.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -69,11 +69,11 @@
__attribute__nonnull__(1);
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void * gc_ms_allocate_memory_chunk(SHIM_INTERP, size_t size);
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void * gc_ms_allocate_memory_chunk_zeroed(SHIM_INTERP, size_t size);
PARROT_CANNOT_RETURN_NULL
@@ -192,7 +192,7 @@
FUNC_MODIFIES(*pool);
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void * gc_ms_reallocate_memory_chunk(SHIM_INTERP,
ARGFREE(void *from),
size_t size);
@@ -1336,7 +1336,7 @@
*/
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void *
gc_ms_allocate_memory_chunk(SHIM_INTERP, size_t size)
{
@@ -1345,13 +1345,13 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void *
gc_ms_reallocate_memory_chunk(SHIM_INTERP, ARGFREE(void *from), size_t size)
{
@@ -1367,13 +1367,13 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void *
gc_ms_allocate_memory_chunk_zeroed(SHIM_INTERP, size_t size)
{
@@ -1382,7 +1382,7 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
Modified: branches/html_cleanup/src/gc/gc_ms2.c
==============================================================================
--- branches/html_cleanup/src/gc/gc_ms2.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/gc/gc_ms2.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -15,6 +15,7 @@
#include "parrot/parrot.h"
#include "parrot/gc_api.h"
#include "parrot/list.h"
+#include "parrot/sysmem.h"
#include "gc_private.h"
#include "fixed_allocator.h"
@@ -80,11 +81,11 @@
__attribute__nonnull__(1);
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void * gc_ms2_allocate_memory_chunk(SHIM_INTERP, size_t size);
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void * gc_ms2_allocate_memory_chunk_zeroed(SHIM_INTERP, size_t size);
PARROT_MALLOC
@@ -211,7 +212,7 @@
__attribute__nonnull__(2);
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void * gc_ms2_reallocate_memory_chunk(SHIM_INTERP,
ARGFREE(void *from),
size_t size);
@@ -373,10 +374,8 @@
=item C<static void gc_ms2_mark_and_sweep(PARROT_INTERP, UINTVAL flags)>
-This function would perform a GC run, if we needed to. Luckily we have
-infinite memory!
-
-This function is called from the GC API function C<Parrot_gc_mark_and_sweep>.
+Performs a GC run. This function is called from the GC API function
+C<Parrot_gc_mark_and_sweep>.
Flags can be a combination of these values:
@@ -388,6 +387,7 @@
*/
+
/*
=item C<static void gc_ms2_compact_memory_pool(PARROT_INTERP)>
@@ -397,6 +397,7 @@
=cut
*/
+
static void
gc_ms2_compact_memory_pool(PARROT_INTERP)
{
@@ -405,6 +406,7 @@
Parrot_gc_str_compact_pool(interp, &self->string_gc);
}
+
/*
=item C<static PMC* gc_ms2_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)>
@@ -449,21 +451,24 @@
gc_ms2_allocate_pmc_attributes(PARROT_INTERP, ARGMOD(PMC *pmc))
{
ASSERT_ARGS(gc_ms2_allocate_pmc_attributes)
- MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
const size_t attr_size = pmc->vtable->attr_size;
- PMC_data(pmc) = Parrot_gc_fixed_allocator_allocate(interp,
- self->fixed_size_allocator, attr_size);
- memset(PMC_data(pmc), 0, attr_size);
+ PMC_data(pmc) = Parrot_gc_fixed_allocator_allocate(interp,
+ self->fixed_size_allocator, attr_size);
+
+ memset(PMC_data(pmc), 0, attr_size);
interp->gc_sys->stats.mem_used_last_collect += attr_size;
return PMC_data(pmc);
}
+
static void
gc_ms2_free_pmc_attributes(PARROT_INTERP, ARGMOD(PMC *pmc))
{
ASSERT_ARGS(gc_ms2_free_pmc_attributes)
+
if (PMC_data(pmc)) {
MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
Parrot_gc_fixed_allocator_free(interp, self->fixed_size_allocator,
@@ -473,6 +478,7 @@
}
}
+
PARROT_CAN_RETURN_NULL
static void*
gc_ms2_allocate_fixed_size_storage(PARROT_INTERP, size_t size)
@@ -483,9 +489,11 @@
interp->gc_sys->stats.memory_allocated += size;
interp->gc_sys->stats.mem_used_last_collect += size;
- return Parrot_gc_fixed_allocator_allocate(interp, self->fixed_size_allocator, size);
+ return Parrot_gc_fixed_allocator_allocate(interp,
+ self->fixed_size_allocator, size);
}
+
static void
gc_ms2_free_fixed_size_storage(PARROT_INTERP, size_t size, ARGMOD(void *data))
{
@@ -496,10 +504,12 @@
interp->gc_sys->stats.memory_allocated -= size;
interp->gc_sys->stats.mem_used_last_collect -= size;
- Parrot_gc_fixed_allocator_free(interp, self->fixed_size_allocator, data, size);
+ Parrot_gc_fixed_allocator_free(interp, self->fixed_size_allocator,
+ data, size);
}
}
+
/*
=item C<static size_t gc_ms2_get_gc_info(PARROT_INTERP, Interpinfo_enum which)>
@@ -523,8 +533,6 @@
}
-
-
/*
=item C<void Parrot_gc_ms2_init(PARROT_INTERP)>
@@ -546,41 +554,42 @@
ASSERT_ARGS(Parrot_gc_ms2_init)
struct MarkSweep_GC *self;
- /* We have to transfer ownership of memory to parent interp in threaded parrot */
- interp->gc_sys->finalize_gc_system = NULL; /* gc_ms2_finalize; */
+ /* We have to transfer ownership of memory to parent interp
+ * in threaded parrot */
+ interp->gc_sys->finalize_gc_system = gc_ms2_finalize;
- interp->gc_sys->do_gc_mark = gc_ms2_mark_and_sweep;
- interp->gc_sys->compact_string_pool = gc_ms2_compact_memory_pool;
+ interp->gc_sys->do_gc_mark = gc_ms2_mark_and_sweep;
+ interp->gc_sys->compact_string_pool = gc_ms2_compact_memory_pool;
/*
interp->gc_sys->mark_special = gc_ms2_mark_special;
*/
interp->gc_sys->pmc_needs_early_collection = gc_ms2_pmc_needs_early_collection;
- interp->gc_sys->allocate_pmc_header = gc_ms2_allocate_pmc_header;
- interp->gc_sys->free_pmc_header = gc_ms2_free_pmc_header;
+ interp->gc_sys->allocate_pmc_header = gc_ms2_allocate_pmc_header;
+ interp->gc_sys->free_pmc_header = gc_ms2_free_pmc_header;
- interp->gc_sys->allocate_string_header = gc_ms2_allocate_string_header;
- interp->gc_sys->free_string_header = gc_ms2_free_string_header;
+ interp->gc_sys->allocate_string_header = gc_ms2_allocate_string_header;
+ interp->gc_sys->free_string_header = gc_ms2_free_string_header;
interp->gc_sys->allocate_bufferlike_header = gc_ms2_allocate_buffer_header;
interp->gc_sys->free_bufferlike_header = gc_ms2_free_buffer_header;
- interp->gc_sys->allocate_pmc_attributes = gc_ms2_allocate_pmc_attributes;
- interp->gc_sys->free_pmc_attributes = gc_ms2_free_pmc_attributes;
+ interp->gc_sys->allocate_pmc_attributes = gc_ms2_allocate_pmc_attributes;
+ interp->gc_sys->free_pmc_attributes = gc_ms2_free_pmc_attributes;
- interp->gc_sys->is_pmc_ptr = gc_ms2_is_pmc_ptr;
- interp->gc_sys->is_string_ptr = gc_ms2_is_string_ptr;
- interp->gc_sys->mark_pmc_header = gc_ms2_mark_pmc_header;
- interp->gc_sys->mark_pobj_header = gc_ms2_mark_pobj_header;
-
- interp->gc_sys->block_mark = gc_ms2_block_GC_mark;
- interp->gc_sys->unblock_mark = gc_ms2_unblock_GC_mark;
- interp->gc_sys->is_blocked_mark = gc_ms2_is_blocked_GC_mark;
-
- interp->gc_sys->block_sweep = gc_ms2_block_GC_sweep;
- interp->gc_sys->unblock_sweep = gc_ms2_unblock_GC_sweep;
- interp->gc_sys->is_blocked_sweep = gc_ms2_is_blocked_GC_sweep;
+ interp->gc_sys->is_pmc_ptr = gc_ms2_is_pmc_ptr;
+ interp->gc_sys->is_string_ptr = gc_ms2_is_string_ptr;
+ interp->gc_sys->mark_pmc_header = gc_ms2_mark_pmc_header;
+ interp->gc_sys->mark_pobj_header = gc_ms2_mark_pobj_header;
+
+ interp->gc_sys->block_mark = gc_ms2_block_GC_mark;
+ interp->gc_sys->unblock_mark = gc_ms2_unblock_GC_mark;
+ interp->gc_sys->is_blocked_mark = gc_ms2_is_blocked_GC_mark;
+
+ interp->gc_sys->block_sweep = gc_ms2_block_GC_sweep;
+ interp->gc_sys->unblock_sweep = gc_ms2_unblock_GC_sweep;
+ interp->gc_sys->is_blocked_sweep = gc_ms2_is_blocked_GC_sweep;
interp->gc_sys->allocate_string_storage = gc_ms2_allocate_string_storage;
interp->gc_sys->reallocate_string_storage = gc_ms2_reallocate_string_storage;
@@ -594,15 +603,16 @@
/* We don't distinguish between chunk and chunk_with_pointers */
interp->gc_sys->allocate_memory_chunk = gc_ms2_allocate_memory_chunk;
interp->gc_sys->reallocate_memory_chunk = gc_ms2_reallocate_memory_chunk;
+
interp->gc_sys->allocate_memory_chunk_with_interior_pointers
= gc_ms2_allocate_memory_chunk_zeroed;
interp->gc_sys->reallocate_memory_chunk_with_interior_pointers
= gc_ms2_reallocate_memory_chunk_zeroed;
interp->gc_sys->free_memory_chunk = gc_ms2_free_memory_chunk;
- interp->gc_sys->iterate_live_strings = gc_ms2_iterate_live_strings;
+ interp->gc_sys->iterate_live_strings = gc_ms2_iterate_live_strings;
- interp->gc_sys->get_gc_info = gc_ms2_get_gc_info;
+ interp->gc_sys->get_gc_info = gc_ms2_get_gc_info;
if (interp->parent_interpreter && interp->parent_interpreter->gc_sys) {
/* This is a "child" interpreter. Just reuse parent one */
@@ -621,51 +631,57 @@
self->fixed_size_allocator = Parrot_gc_fixed_allocator_new(interp);
- /* Collect every 256M allocated. */
- /* Hardcode for now. Will be configured via CLI */
- self->gc_threshold = 256 * 1024 * 1024;
+ self->gc_threshold = Parrot_sysmem_amount(interp) / 8;
}
- interp->gc_sys->gc_private = self;
+ interp->gc_sys->gc_private = self;
Parrot_gc_str_initialize(interp, &self->string_gc);
}
+
/*
+
=item C<static void gc_ms2_finalize(PARROT_INTERP)>
Finalize GC subsystem.
=cut
+
*/
+
static void
gc_ms2_finalize(PARROT_INTERP)
{
ASSERT_ARGS(gc_ms2_finalize)
- MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
- Parrot_gc_str_finalize(interp, &self->string_gc);
+ if (!interp->parent_interpreter) {
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+
+ Parrot_gc_str_finalize(interp, &self->string_gc);
- Parrot_list_destroy(interp, self->objects);
- Parrot_list_destroy(interp, self->strings);
- Parrot_gc_pool_destroy(interp, self->pmc_allocator);
- Parrot_gc_pool_destroy(interp, self->string_allocator);
- Parrot_gc_fixed_allocator_destroy(interp, self->fixed_size_allocator);
+ Parrot_list_destroy(interp, self->objects);
+ Parrot_list_destroy(interp, self->strings);
+ Parrot_gc_pool_destroy(interp, self->pmc_allocator);
+ Parrot_gc_pool_destroy(interp, self->string_allocator);
+ Parrot_gc_fixed_allocator_destroy(interp, self->fixed_size_allocator);
+ }
}
+
PARROT_MALLOC
PARROT_CAN_RETURN_NULL
static PMC*
gc_ms2_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)
{
ASSERT_ARGS(gc_ms2_allocate_pmc_header)
- MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
List_Item_Header *ptr;
- PMC *ret;
gc_ms2_maybe_mark_and_sweep(interp);
/* Increase used memory. Not precisely accurate due Pool_Allocator paging */
++interp->gc_sys->stats.header_allocs_since_last_collect;
+
interp->gc_sys->stats.memory_allocated += sizeof (PMC);
interp->gc_sys->stats.mem_used_last_collect += sizeof (PMC);
@@ -673,16 +689,16 @@
self->pmc_allocator);
LIST_APPEND(self->objects, ptr);
- ret = LLH2Obj_typed(ptr, PMC);
-
- return ret;
+ return LLH2Obj_typed(ptr, PMC);
}
+
static void
gc_ms2_free_pmc_header(PARROT_INTERP, ARGFREE(PMC *pmc))
{
ASSERT_ARGS(gc_ms2_free_pmc_header)
MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+
if (pmc) {
if (PObj_on_free_list_TEST(pmc))
return;
@@ -699,6 +715,7 @@
}
}
+
/*
=item C<static void gc_ms2_mark_pmc_header(PARROT_INTERP, PMC *pmc)>
@@ -728,11 +745,12 @@
}
+
/*
=item C<static int gc_ms2_is_pmc_ptr(PARROT_INTERP, void *ptr)>
-establish if *ptr is.owned
+Establish if *ptr is.owned.
=cut
@@ -746,11 +764,12 @@
return gc_ms2_is_ptr_owned(interp, ptr, self->pmc_allocator, self->objects);
}
+
/*
=item C<static void gc_ms2_sweep_pmc_cb(PARROT_INTERP, PObj *obj)>
-destroy pmc *obj
+Destroys PMC *obj.
=cut
@@ -760,11 +779,12 @@
gc_ms2_sweep_pmc_cb(PARROT_INTERP, ARGIN(PObj *obj))
{
ASSERT_ARGS(gc_ms2_sweep_pmc_cb)
- PMC *pmc = (PMC *)obj;
- Parrot_pmc_destroy(interp, pmc);
+ Parrot_pmc_destroy(interp, (PMC *)obj);
}
+
/*
+
=item C<gc_ms2_allocate_string_header()>
=item C<gc_ms2_free_string_header()>
@@ -805,19 +825,23 @@
return ret;
}
+
static void
gc_ms2_free_string_header(PARROT_INTERP, ARGFREE(STRING *s))
{
ASSERT_ARGS(gc_ms2_free_string_header)
- MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
- if (s) {
- if (PObj_on_free_list_TEST(s))
- return;
+
+ if (s
+ && !PObj_on_free_list_TEST(s)) {
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+
Parrot_list_remove(interp, self->strings, Obj2LLH(s));
- PObj_on_free_list_SET(s);
if (Buffer_bufstart(s) && !PObj_external_TEST(s))
- Parrot_gc_str_free_buffer_storage(interp, &self->string_gc, (Buffer *)s);
+ Parrot_gc_str_free_buffer_storage(interp,
+ &self->string_gc, (Buffer *)s);
+
+ PObj_on_free_list_SET(s);
Parrot_gc_pool_free(interp, self->string_allocator, Obj2LLH(s));
@@ -827,15 +851,17 @@
}
}
+
PARROT_MALLOC
PARROT_CAN_RETURN_NULL
static Buffer*
gc_ms2_allocate_buffer_header(PARROT_INTERP, SHIM(size_t size))
{
ASSERT_ARGS(gc_ms2_allocate_buffer_header)
- return (Buffer*)gc_ms2_allocate_string_header(interp, 0);
+ return (Buffer *)gc_ms2_allocate_string_header(interp, 0);
}
+
static void
gc_ms2_free_buffer_header(PARROT_INTERP, ARGFREE(Buffer *s), SHIM(size_t size))
{
@@ -843,11 +869,12 @@
gc_ms2_free_string_header(interp, (STRING*)s);
}
+
/*
=item C<static int gc_ms2_is_string_ptr(PARROT_INTERP, void *ptr)>
-establish if string *ptr is owned
+Establish if STRING *ptr is owned.
=cut
@@ -858,9 +885,11 @@
{
ASSERT_ARGS(gc_ms2_is_string_ptr)
MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
- return gc_ms2_is_ptr_owned(interp, ptr, self->string_allocator, self->strings);
+ return gc_ms2_is_ptr_owned(interp, ptr, self->string_allocator,
+ self->strings);
}
+
/*
item C<void gc_ms_allocate_string_storage(PARROT_INTERP, STRING *str, size_t
@@ -878,6 +907,7 @@
Functions for allocating strings/buffers storage.
=cut
+
*/
static void
@@ -889,6 +919,7 @@
interp->gc_sys->stats.mem_used_last_collect += size;
}
+
static void
gc_ms2_reallocate_string_storage(PARROT_INTERP, ARGIN(STRING *str), size_t size)
{
@@ -898,6 +929,7 @@
interp->gc_sys->stats.mem_used_last_collect += size;
}
+
static void
gc_ms2_allocate_buffer_storage(PARROT_INTERP, ARGIN(Buffer *str), size_t size)
{
@@ -907,6 +939,7 @@
interp->gc_sys->stats.mem_used_last_collect += size;
}
+
static void
gc_ms2_reallocate_buffer_storage(PARROT_INTERP, ARGIN(Buffer *str), size_t size)
{
@@ -916,11 +949,12 @@
interp->gc_sys->stats.mem_used_last_collect += size;
}
+
/*
=item C<static void gc_ms2_mark_pobj_header(PARROT_INTERP, PObj * obj)>
-Mark PObj as live.
+Marks PObj as live.
=cut
@@ -938,11 +972,12 @@
}
}
+
/*
=item C<static void gc_ms2_sweep_string_cb(PARROT_INTERP, PObj *obj)>
-destroy string *obj
+Destroys STRING *obj.
=cut
@@ -954,7 +989,8 @@
ASSERT_ARGS(gc_ms2_sweep_string_cb)
MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
Buffer *str = (Buffer *)obj;
- /* Compact string pool here. Or get rid of "shared buffers" and just free storage */
+ /* Compact string pool here.
+ * (or get rid of "shared buffers" and just free storage) */
if (Buffer_bufstart(str) && !PObj_external_TEST(str))
Parrot_gc_str_free_buffer_storage(interp, &self->string_gc, str);
}
@@ -965,11 +1001,13 @@
=item C<static void gc_ms2_iterate_live_strings(PARROT_INTERP,
string_iterator_callback callback, void *data)>
-Iterate over live string invoking callback for each of them. Used during
+Iterates over live strings invoking callback for each of them. Used during
compacting of string pool.
=cut
+
*/
+
static void
gc_ms2_iterate_live_strings(PARROT_INTERP,
string_iterator_callback callback,
@@ -992,11 +1030,10 @@
gc_ms2_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
{
ASSERT_ARGS(gc_ms2_mark_and_sweep)
- MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
List_Item_Header *tmp;
Linked_List *list;
size_t counter;
- UNUSED(flags);
/* GC is blocked */
if (self->gc_mark_block_level)
@@ -1022,13 +1059,15 @@
Parrot_gc_trace_root(interp, NULL, GC_TRACE_FULL);
if (interp->pdb && interp->pdb->debugger) {
- Parrot_gc_trace_root(interp->pdb->debugger, NULL, (Parrot_gc_trace_type)0);
+ Parrot_gc_trace_root(interp->pdb->debugger, NULL,
+ (Parrot_gc_trace_type)0);
}
- /* new_objects are "gray" untill fully marked */
- /* Additional gray objects will appened to new_objects list */
+ /* new_objects are "gray" until fully marked */
+ /* Additional gray objects will append to new_objects list */
/* So, iterate over them in one go */
tmp = self->new_objects->first;
+
while (tmp) {
PMC *pmc = LLH2Obj_typed(tmp, PMC);
/* if object is a PMC and contains buffers or PMCs, then attach the PMC
@@ -1048,35 +1087,40 @@
/* objects contains "dead" or "constant" PMCs */
/* sweep of new_objects will repaint them white */
/* sweep of objects will destroy dead objects leaving only "constant" */
- gc_ms2_sweep_pool(interp, self->pmc_allocator, self->new_objects, gc_ms2_sweep_pmc_cb);
- gc_ms2_sweep_pool(interp, self->pmc_allocator, self->objects, gc_ms2_sweep_pmc_cb);
- gc_ms2_sweep_pool(interp, self->string_allocator, self->strings, gc_ms2_sweep_string_cb);
+ gc_ms2_sweep_pool(interp, self->pmc_allocator, self->new_objects,
+ gc_ms2_sweep_pmc_cb);
+ gc_ms2_sweep_pool(interp, self->pmc_allocator, self->objects,
+ gc_ms2_sweep_pmc_cb);
+ gc_ms2_sweep_pool(interp, self->string_allocator, self->strings,
+ gc_ms2_sweep_string_cb);
/* Replace objects with new_objects. Ignoring "constant" one */
- list = self->objects;
+ list = self->objects;
self->objects = self->new_objects;
Parrot_list_destroy(interp, list);
- interp->gc_sys->stats.header_allocs_since_last_collect = 0;
+ /* We swept all dead objects */
+ self->num_early_gc_PMCs = 0;
interp->gc_sys->stats.mem_used_last_collect = 0;
- interp->gc_sys->stats.gc_mark_runs++;
+ interp->gc_sys->stats.header_allocs_since_last_collect = 0;
self->gc_mark_block_level--;
- /* We swept all dead objects */
- self->num_early_gc_PMCs = 0;
+ interp->gc_sys->stats.gc_mark_runs++;
gc_ms2_compact_memory_pool(interp);
}
-
/*
+
=item C<static void gc_ms2_sweep_pool(PARROT_INTERP, Pool_Allocator *pool,
Linked_List *list, sweep_cb callback)>
Helper function to sweep pool.
=cut
+
*/
+
static void
gc_ms2_sweep_pool(PARROT_INTERP,
ARGIN(Pool_Allocator *pool),
@@ -1085,34 +1129,39 @@
{
ASSERT_ARGS(gc_ms2_sweep_pool)
List_Item_Header *tmp = list->first;
+
while (tmp) {
List_Item_Header *next = tmp->next;
PObj *obj = LLH2Obj_typed(tmp, PObj);
- if (PObj_live_TEST(obj)) {
- /* Paint live objects white */
+
+ /* Paint live objects white */
+ if (PObj_live_TEST(obj))
PObj_live_CLEAR(obj);
- }
+
else if (!PObj_constant_TEST(obj)) {
- PObj_on_free_list_SET(obj);
LIST_REMOVE(list, tmp);
callback(interp, obj);
+ PObj_on_free_list_SET(obj);
+
Parrot_gc_pool_free(interp, pool, tmp);
}
+
tmp = next;
}
}
-
/*
+
=item C<static int gc_ms2_is_ptr_owned(PARROT_INTERP, void *ptr, Pool_Allocator
*pool, Linked_List *list)>
Helper function to check that we own PObj
=cut
+
*/
static int
@@ -1181,6 +1230,7 @@
Parrot_shared_gc_block(interp);
}
+
static void
gc_ms2_unblock_GC_mark(PARROT_INTERP)
{
@@ -1192,6 +1242,7 @@
}
}
+
static void
gc_ms2_block_GC_sweep(PARROT_INTERP)
{
@@ -1200,6 +1251,7 @@
++self->gc_sweep_block_level;
}
+
static void
gc_ms2_unblock_GC_sweep(PARROT_INTERP)
{
@@ -1209,6 +1261,7 @@
--self->gc_sweep_block_level;
}
+
static unsigned int
gc_ms2_is_blocked_GC_mark(PARROT_INTERP)
{
@@ -1217,6 +1270,7 @@
return self->gc_mark_block_level;
}
+
static unsigned int
gc_ms2_is_blocked_GC_sweep(PARROT_INTERP)
{
@@ -1226,7 +1280,6 @@
}
-
/*
=item C<static void * gc_ms2_allocate_memory_chunk(PARROT_INTERP, size_t size)>
@@ -1249,7 +1302,7 @@
*/
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void *
gc_ms2_allocate_memory_chunk(SHIM_INTERP, size_t size)
{
@@ -1258,13 +1311,14 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
+
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void *
gc_ms2_reallocate_memory_chunk(SHIM_INTERP, ARGFREE(void *from), size_t size)
{
@@ -1280,13 +1334,14 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
+
PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
static void *
gc_ms2_allocate_memory_chunk_zeroed(SHIM_INTERP, size_t size)
{
@@ -1295,11 +1350,12 @@
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Allocated %i at %p\n", size, ptr);
#endif
- if (!ptr)
+ if (!ptr && size)
PANIC_OUT_OF_MEM(size);
return ptr;
}
+
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
static void *
@@ -1313,6 +1369,7 @@
return ptr;
}
+
static void
gc_ms2_free_memory_chunk(SHIM_INTERP, ARGFREE(void *data))
{
@@ -1324,6 +1381,7 @@
free(data);
}
+
PARROT_DOES_NOT_RETURN
static void
failed_allocation(unsigned int line, unsigned long size)
@@ -1338,7 +1396,7 @@
=item C<static void gc_ms2_pmc_needs_early_collection(PARROT_INTERP, PMC *pmc)>
-Mark a PMC as needing timely destruction
+Marks a PMC as needing timely destruction.
=cut
@@ -1352,16 +1410,18 @@
++self->num_early_gc_PMCs;
}
+
/*
=item C<static void gc_ms2_maybe_mark_and_sweep(PARROT_INTERP)>
-Maybe M&S. Depends on total allocated memory, memory allocated since last alloc
-and phase of the Moon.
+Maybe M&S. Depends on total allocated memory, memory allocated since last
+alloc, and phase of the Moon.
=cut
*/
+
static void
gc_ms2_maybe_mark_and_sweep(PARROT_INTERP)
{
@@ -1369,18 +1429,19 @@
MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
- /* Collect every 256M. Hardcode for now. Will be configured via CLI */
+ /* Collect every ~n bytes */
if (interp->gc_sys->stats.mem_used_last_collect > self->gc_threshold) {
gc_ms2_mark_and_sweep(interp, 0);
}
}
+
/*
=item C<static size_t gc_ms2_count_used_string_memory(PARROT_INTERP, Linked_List
*list)>
-find amount of used string memory
+Finds the amount of used STRING memory.
=cut
@@ -1391,17 +1452,16 @@
{
ASSERT_ARGS(gc_ms2_count_used_string_memory)
- size_t total_amount = 0;
+ List_Item_Header *tmp = list->first;
+ size_t total_amount = 0;
- List_Item_Header *tmp = list->first;
while (tmp) {
List_Item_Header *next = tmp->next;
PObj *obj = LLH2Obj_typed(tmp, PObj);
STRING *str = (STRING*)obj;
/* Header size */
- total_amount += sizeof (List_Item_Header)
- + sizeof (STRING*);
+ total_amount += sizeof (List_Item_Header) + sizeof (STRING *);
total_amount += str->bufused;
tmp = next;
@@ -1410,12 +1470,13 @@
return total_amount;
}
+
/*
=item C<static size_t gc_ms2_count_used_pmc_memory(PARROT_INTERP, Linked_List
*list)>
-find amount of used pmc memory
+Finds the amount of used PMC memory.
=cut
@@ -1426,16 +1487,15 @@
{
ASSERT_ARGS(gc_ms2_count_used_pmc_memory)
- size_t total_amount = 0;
+ List_Item_Header *tmp = list->first;
+ size_t total_amount = 0;
- List_Item_Header *tmp = list->first;
while (tmp) {
List_Item_Header *next = tmp->next;
PMC *obj = LLH2Obj_typed(tmp, PMC);
/* Header size */
- total_amount += sizeof (List_Item_Header)
- + sizeof (PMC*);
+ total_amount += sizeof (List_Item_Header) + sizeof (PMC *);
total_amount += obj->vtable->attr_size;
tmp = next;
@@ -1444,6 +1504,7 @@
return total_amount;
}
+
/*
=back
Modified: branches/html_cleanup/src/hash.c
==============================================================================
--- branches/html_cleanup/src/hash.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/hash.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -141,34 +141,11 @@
PARROT_WARN_UNUSED_RESULT
PARROT_PURE_FUNCTION
PARROT_INLINE
-static size_t key_hash_int(SHIM_INTERP,
- ARGIN_NULLOK(const void *value),
- size_t seed);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-PARROT_INLINE
-static size_t key_hash_PMC(PARROT_INTERP,
- ARGIN(PMC *value),
- SHIM(size_t seed))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-PARROT_INLINE
-static size_t key_hash_pointer(SHIM_INTERP,
- ARGIN(const void *value),
+static size_t key_hash_STRING(PARROT_INTERP,
+ ARGIN(const STRING *s),
size_t seed)
- __attribute__nonnull__(2);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-PARROT_INLINE
-static size_t key_hash_STRING(PARROT_INTERP, ARGMOD(STRING *s), size_t seed)
__attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*s);
+ __attribute__nonnull__(2);
PARROT_CAN_RETURN_NULL
static HashBucket * parrot_hash_get_bucket_string(PARROT_INTERP,
@@ -239,12 +216,6 @@
, PARROT_ASSERT_ARG(hash))
#define ASSERT_ARGS_key_hash_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(value))
-#define ASSERT_ARGS_key_hash_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_key_hash_PMC __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(value))
-#define ASSERT_ARGS_key_hash_pointer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(value))
#define ASSERT_ARGS_key_hash_STRING __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(s))
@@ -270,7 +241,8 @@
/*
-=item C<static size_t key_hash_STRING(PARROT_INTERP, STRING *s, size_t seed)>
+=item C<static size_t key_hash_STRING(PARROT_INTERP, const STRING *s, size_t
+seed)>
Returns the hashed value of the key C<value>. See also string.c.
@@ -283,14 +255,14 @@
PARROT_PURE_FUNCTION
PARROT_INLINE
static size_t
-key_hash_STRING(PARROT_INTERP, ARGMOD(STRING *s), size_t seed)
+key_hash_STRING(PARROT_INTERP, ARGIN(const STRING *s), size_t seed)
{
ASSERT_ARGS(key_hash_STRING)
if (s->hashval)
return s->hashval;
- return Parrot_str_to_hashval(interp, s);
+ return STRING_hash(interp, s, seed);
}
@@ -316,7 +288,7 @@
STRING const *s1 = (STRING const *)search_key;
STRING const *s2 = (STRING const *)bucket_key;
- return Parrot_str_equal(interp, s1, s2) == 0;
+ return !STRING_equal(interp, s1, s2);
}
@@ -372,28 +344,6 @@
/*
-=item C<static size_t key_hash_pointer(PARROT_INTERP, const void *value, size_t
-seed)>
-
-Returns a hashvalue for a pointer.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-PARROT_INLINE
-static size_t
-key_hash_pointer(SHIM_INTERP, ARGIN(const void *value), size_t seed)
-{
- ASSERT_ARGS(key_hash_pointer)
- return ((size_t) value) ^ seed;
-}
-
-
-/*
-
=item C<static size_t key_hash_cstring(PARROT_INTERP, const void *value, size_t
seed)>
@@ -450,26 +400,6 @@
/*
-=item C<static size_t key_hash_PMC(PARROT_INTERP, PMC *value, size_t seed)>
-
-Returns a hashed value for an PMC key (passed as a void pointer, sadly).
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-PARROT_INLINE
-static size_t
-key_hash_PMC(PARROT_INTERP, ARGIN(PMC *value), SHIM(size_t seed))
-{
- ASSERT_ARGS(key_hash_PMC)
- return VTABLE_hashvalue(interp, value);
-}
-
-/*
-
=item C<static int hash_compare_pmc(PARROT_INTERP, PMC *a, PMC *b)>
Compares two PMC for equality, returning 0 if the first is equal to second.
@@ -500,27 +430,6 @@
/*
-=item C<static size_t key_hash_int(PARROT_INTERP, const void *value, size_t
-seed)>
-
-Returns a hashed value for an integer key (passed as a void pointer, sadly).
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-PARROT_INLINE
-static size_t
-key_hash_int(SHIM_INTERP, ARGIN_NULLOK(const void *value), size_t seed)
-{
- ASSERT_ARGS(key_hash_int)
- return (size_t)value ^ seed;
-}
-
-/*
-
=item C<static int hash_compare_int(PARROT_INTERP, const void *a, const void
*b)>
@@ -1499,7 +1408,7 @@
if ((STRING_byte_length(s) == STRING_byte_length(s2))
&& (memcmp(s->strstart, s2->strstart, STRING_byte_length(s)) == 0))
break;
- } else if (Parrot_str_equal(interp, s, s2))
+ } else if (STRING_equal(interp, s, s2))
break;
}
bucket = bucket->next;
Modified: branches/html_cleanup/src/hll.c
==============================================================================
--- branches/html_cleanup/src/hll.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/hll.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -209,7 +209,7 @@
if (!PMC_IS_NULL(lib_name)) {
const STRING * const lib_name_str = VTABLE_get_string(interp, lib_name);
- if (Parrot_str_equal(interp, lib_name_str, hll_lib))
+ if (STRING_equal(interp, lib_name_str, hll_lib))
break;
}
}
Modified: branches/html_cleanup/src/interp/inter_create.c
==============================================================================
--- branches/html_cleanup/src/interp/inter_create.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/interp/inter_create.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -457,6 +457,10 @@
if (interp->thread_data)
mem_internal_free(interp->thread_data);
+ /* get rid of ops */
+ if (interp->op_hash)
+ parrot_hash_destroy(interp, interp->op_hash);
+
/* free vtables */
parrot_free_vtables(interp);
@@ -489,6 +493,8 @@
mem_internal_free(interp);
}
}
+
+ interp->op_hash = NULL;
}
Modified: branches/html_cleanup/src/io/api.c
==============================================================================
--- branches/html_cleanup/src/io/api.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/io/api.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -364,7 +364,7 @@
if (offset + read_length > orig_length)
read_length = orig_length - offset;
- result = Parrot_str_substr(interp, string_orig, offset, read_length);
+ result = STRING_substr(interp, string_orig, offset, read_length);
SETATTR_StringHandle_read_offset(interp, pmc, offset + read_length);
}
}
@@ -414,7 +414,7 @@
orig_length = Parrot_str_byte_length(interp, result);
GETATTR_StringHandle_read_offset(interp, pmc, offset);
- newline_pos = Parrot_str_find_index(interp, result, CONST_STRING(interp, "\n"), offset);
+ newline_pos = STRING_index(interp, result, CONST_STRING(interp, "\n"), offset);
/* No newline found, read the rest of the string. */
if (newline_pos == -1)
@@ -422,7 +422,7 @@
else
read_length = newline_pos - offset + 1; /* +1 to include the newline */
- result = Parrot_str_substr(interp, result, offset, read_length);
+ result = STRING_substr(interp, result, offset, read_length);
SETATTR_StringHandle_read_offset(interp, pmc, newline_pos + 1);
}
else
Modified: branches/html_cleanup/src/io/buffer.c
==============================================================================
--- branches/html_cleanup/src/io/buffer.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/io/buffer.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -338,7 +338,7 @@
STRING *sf;
s->strlen = s->bufused = current + len;
- sf = Parrot_str_substr(interp, s, current, len);
+ sf = STRING_substr(interp, s, current, len);
got = PIO_READ(interp, filehandle, &sf);
s->strlen = s->bufused = current + got;
Modified: branches/html_cleanup/src/io/filehandle.c
==============================================================================
--- branches/html_cleanup/src/io/filehandle.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/io/filehandle.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -52,7 +52,7 @@
mode_len = Parrot_str_byte_length(interp, mode_str);
for (i = 0; i < mode_len; ++i) {
- const INTVAL s = Parrot_str_indexed(interp, mode_str, i);
+ const INTVAL s = STRING_ord(interp, mode_str, i);
switch (s) {
case 'r':
flags |= PIO_F_READ;
@@ -674,7 +674,7 @@
if (STRING_IS_NULL(handle_struct->encoding))
return 0;
- if (Parrot_str_equal(interp, value, handle_struct->encoding))
+ if (STRING_equal(interp, value, handle_struct->encoding))
return 1;
return 0;
Modified: branches/html_cleanup/src/library.c
==============================================================================
--- branches/html_cleanup/src/library.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/library.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -413,7 +413,7 @@
* the goal is just to have for sure an invisible 0 at end
*/
- STRING * const nul = string_chr(interp, '\0');
+ STRING * const nul = Parrot_str_chr(interp, '\0');
path = Parrot_str_concat(interp, path, nul);
--path->bufused;
@@ -445,12 +445,11 @@
path_guarantee_trailing_separator(PARROT_INTERP, ARGMOD(STRING *path))
{
ASSERT_ARGS(path_guarantee_trailing_separator)
- STRING * const path_separator_string = string_chr(interp, path_separator);
/* make sure the path has a trailing slash before appending the file */
- if (Parrot_str_indexed(interp, path , path->strlen - 1)
- != Parrot_str_indexed(interp, path_separator_string, 0))
- path = Parrot_str_concat(interp, path , path_separator_string);
+ if (STRING_ord(interp, path, -1) != path_separator)
+ path = Parrot_str_concat(interp, path,
+ Parrot_str_chr(interp, path_separator));
return path;
}
@@ -573,9 +572,9 @@
if (!STRING_IS_NULL(test_path)) {
if (Parrot_str_byte_length(interp, test_path) > 4) {
- STRING *orig_ext = Parrot_str_substr(interp, test_path, -4, 4);
+ STRING *orig_ext = STRING_substr(interp, test_path, -4, 4);
/* First try substituting .pbc for the .pir extension */
- if (Parrot_str_equal(interp, orig_ext, pir_extension)) {
+ if (STRING_equal(interp, orig_ext, pir_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
test_path = Parrot_str_concat(interp, without_ext, bytecode_extension);
result = try_load_path(interp, test_path);
@@ -583,7 +582,7 @@
return result;
}
/* Next try substituting .pir, then .pasm for the .pbc extension */
- else if (Parrot_str_equal(interp, orig_ext, bytecode_extension)) {
+ else if (STRING_equal(interp, orig_ext, bytecode_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
test_path = Parrot_str_concat(interp, without_ext, pir_extension);
result = try_load_path(interp, test_path);
@@ -600,8 +599,8 @@
/* Finally, try substituting .pbc for the .pasm extension. */
if (Parrot_str_byte_length(interp, test_path) > 5) {
- STRING * const orig_ext = Parrot_str_substr(interp, test_path, -5, 5);
- if (Parrot_str_equal(interp, orig_ext, pasm_extension)) {
+ STRING * const orig_ext = STRING_substr(interp, test_path, -5, 5);
+ if (STRING_equal(interp, orig_ext, pasm_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 5);
test_path = Parrot_str_concat(interp, without_ext, bytecode_extension);
result = try_load_path(interp, test_path);
@@ -866,24 +865,24 @@
++pos_dot;
++pos_sl;
if (pos_sl && pos_dot) {
- stem = Parrot_str_substr(interp, in, pos_sl, pos_dot - pos_sl - 1);
- *wo_ext = Parrot_str_substr(interp, in, 0, pos_dot - 1);
- *ext = Parrot_str_substr(interp, in, pos_dot, len - pos_dot);
+ stem = STRING_substr(interp, in, pos_sl, pos_dot - pos_sl - 1);
+ *wo_ext = STRING_substr(interp, in, 0, pos_dot - 1);
+ *ext = STRING_substr(interp, in, pos_dot, len - pos_dot);
}
else if (pos_dot) {
- stem = Parrot_str_substr(interp, in, 0, pos_dot - 1);
+ stem = STRING_substr(interp, in, 0, pos_dot - 1);
*wo_ext = stem;
- *ext = Parrot_str_substr(interp, in, pos_dot, len - pos_dot);
+ *ext = STRING_substr(interp, in, pos_dot, len - pos_dot);
}
else if (pos_sl) {
- stem = Parrot_str_substr(interp, in, pos_sl, len - pos_sl);
+ stem = STRING_substr(interp, in, pos_sl, len - pos_sl);
*wo_ext = in;
- *ext = NULL;
+ *ext = STRINGNULL;
}
else {
stem = in;
*wo_ext = stem;
- *ext = NULL;
+ *ext = STRINGNULL;
}
return stem;
}
Modified: branches/html_cleanup/src/list.c
==============================================================================
--- branches/html_cleanup/src/list.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/list.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -114,6 +114,7 @@
*/
PARROT_EXPORT
+PARROT_CAN_RETURN_NULL
List_Item_Header*
Parrot_list_remove(SHIM_INTERP, ARGMOD(Linked_List *list), ARGMOD(List_Item_Header *item))
{
@@ -151,6 +152,7 @@
*/
PARROT_EXPORT
+PARROT_CAN_RETURN_NULL
List_Item_Header*
Parrot_list_pop(PARROT_INTERP, ARGIN(Linked_List *list))
{
Modified: branches/html_cleanup/src/multidispatch.c
==============================================================================
--- branches/html_cleanup/src/multidispatch.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/multidispatch.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -401,13 +401,13 @@
STRING *type_name = VTABLE_get_string_keyed_int(interp, type_list, i);
INTVAL type;
- if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "DEFAULT")))
+ if (STRING_equal(interp, type_name, CONST_STRING(interp, "DEFAULT")))
type = enum_type_PMC;
- else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "STRING")))
+ else if (STRING_equal(interp, type_name, CONST_STRING(interp, "STRING")))
type = enum_type_STRING;
- else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "INTVAL")))
+ else if (STRING_equal(interp, type_name, CONST_STRING(interp, "INTVAL")))
type = enum_type_INTVAL;
- else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "FLOATVAL")))
+ else if (STRING_equal(interp, type_name, CONST_STRING(interp, "FLOATVAL")))
type = enum_type_FLOATVAL;
else
type = Parrot_pmc_get_type_str(interp, type_name);
Modified: branches/html_cleanup/src/oo.c
==============================================================================
--- branches/html_cleanup/src/oo.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/oo.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -1274,7 +1274,7 @@
const STRING * const check =
VTABLE_get_string_keyed_int(interp, exclude, i);
- if (Parrot_str_equal(interp, check, method_name)) {
+ if (STRING_equal(interp, check, method_name)) {
excluded = 1;
break;
}
Modified: branches/html_cleanup/src/ops/cmp.ops
==============================================================================
--- branches/html_cleanup/src/ops/cmp.ops Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/ops/cmp.ops Sun Oct 24 12:14:32 2010 (r49645)
@@ -78,7 +78,7 @@
}
op eq(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_equal(interp, $1, $2)) {
+ if (STRING_equal(interp, $1, $2)) {
goto OFFSET($3);
}
}
@@ -114,7 +114,7 @@
}
op eq(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_equal(interp, VTABLE_get_string(interp, $1), $2)) {
+ if (STRING_equal(interp, VTABLE_get_string(interp, $1), $2)) {
goto OFFSET($3);
}
}
@@ -184,7 +184,7 @@
}
op ne(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_not_equal(interp, $1, $2)) {
+ if (!STRING_equal(interp, $1, $2)) {
goto OFFSET($3);
}
}
@@ -214,7 +214,7 @@
}
op ne(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_not_equal(interp, VTABLE_get_string(interp, $1), $2)) {
+ if (!STRING_equal(interp, VTABLE_get_string(interp, $1), $2)) {
goto OFFSET($3);
}
}
@@ -280,7 +280,7 @@
}
op lt(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, $1, $2) < 0) {
+ if (STRING_compare(interp, $1, $2) < 0) {
goto OFFSET($3);
}
}
@@ -310,7 +310,7 @@
}
op lt(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, $1), $2) < 0) {
+ if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) < 0) {
goto OFFSET($3);
}
}
@@ -364,7 +364,7 @@
}
op le(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, $1, $2) <= 0) {
+ if (STRING_compare(interp, $1, $2) <= 0) {
goto OFFSET($3);
}
}
@@ -394,7 +394,7 @@
}
op le(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, $1), $2) <= 0) {
+ if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) <= 0) {
goto OFFSET($3);
}
}
@@ -454,7 +454,7 @@
}
op gt(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, $1), $2) > 0) {
+ if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) > 0) {
goto OFFSET($3);
}
}
@@ -514,7 +514,7 @@
}
op ge(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, $1), $2) >= 0) {
+ if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) >= 0) {
goto OFFSET($3);
}
}
@@ -627,7 +627,7 @@
}
inline op cmp(out INT, in STR, in STR) :base_core {
- $1 = Parrot_str_compare(interp, $2, $3);
+ $1 = STRING_compare(interp, $2, $3);
}
inline op cmp(out INT, invar PMC, invar PMC) :base_core {
@@ -650,7 +650,7 @@
inline op cmp(out INT, invar PMC, in STR) :base_core {
STRING* const l = VTABLE_get_string(interp, $2);
- $1 = Parrot_str_compare(interp, l, $3);
+ $1 = STRING_compare(interp, l, $3);
}
inline op cmp_str(out INT, invar PMC, invar PMC) :base_core {
@@ -801,7 +801,7 @@
}
inline op isle(out INT, in STR, in STR) {
- $1 = Parrot_str_compare(interp, $2, $3) <= 0;
+ $1 = STRING_compare(interp, $2, $3) <= 0;
}
inline op isle(out INT, invar PMC, invar PMC) {
@@ -829,7 +829,7 @@
}
inline op islt(out INT, in STR, in STR) {
- $1 = Parrot_str_compare(interp, $2, $3) < 0;
+ $1 = STRING_compare(interp, $2, $3) < 0;
}
inline op islt(out INT, invar PMC, invar PMC) {
@@ -857,7 +857,7 @@
}
inline op iseq(out INT, in STR, in STR) {
- $1 = (Parrot_str_equal(interp, $2, $3) ? 1 : 0);
+ $1 = STRING_equal(interp, $2, $3);
}
inline op iseq(out INT, invar PMC, invar PMC) {
@@ -888,7 +888,7 @@
}
inline op isne(out INT, in STR, in STR) {
- $1 = (Parrot_str_not_equal(interp, $2, $3) ? 1 : 0);
+ $1 = !STRING_equal(interp, $2, $3);
}
inline op isne(out INT, invar PMC, invar PMC) {
Modified: branches/html_cleanup/src/ops/core.ops
==============================================================================
--- branches/html_cleanup/src/ops/core.ops Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/ops/core.ops Sun Oct 24 12:14:32 2010 (r49645)
@@ -942,7 +942,7 @@
.TOTAL_MEM_ALLOC, .GC_MARK_RUNS, .GC_COLLECT_RUNS, .ACTIVE_PMCS, .ACTIVE_BUFFERS,
.TOTAL_PMCS, .TOTAL_BUFFERS, .HEADER_ALLOCS_SINCE_COLLECT,
.MEM_ALLOCS_SINCE_COLLECT, .TOTAL_COPIED, .IMPATIENT_PMCS, .GC_LAZY_MARK_RUNS,
-.EXTENDED_PMCS, .RUNCORE
+.EXTENDED_PMCS, .CURRENT_RUNCORE
=item B<interpinfo>(out PMC, in INT)
Modified: branches/html_cleanup/src/ops/core_ops.c
==============================================================================
--- branches/html_cleanup/src/ops/core_ops.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/ops/core_ops.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -16748,7 +16748,7 @@
opcode_t *
Parrot_eq_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16756,7 +16756,7 @@
opcode_t *
Parrot_eq_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16764,7 +16764,7 @@
opcode_t *
Parrot_eq_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16836,7 +16836,7 @@
opcode_t *
Parrot_eq_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16844,7 +16844,7 @@
opcode_t *
Parrot_eq_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16956,7 +16956,7 @@
opcode_t *
Parrot_ne_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16964,7 +16964,7 @@
opcode_t *
Parrot_ne_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16972,7 +16972,7 @@
opcode_t *
Parrot_ne_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17032,7 +17032,7 @@
opcode_t *
Parrot_ne_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17040,7 +17040,7 @@
opcode_t *
Parrot_ne_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17152,7 +17152,7 @@
opcode_t *
Parrot_lt_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SREG(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SREG(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17160,7 +17160,7 @@
opcode_t *
Parrot_lt_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SCONST(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SCONST(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17168,7 +17168,7 @@
opcode_t *
Parrot_lt_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SREG(1), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SREG(1), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17228,7 +17228,7 @@
opcode_t *
Parrot_lt_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17236,7 +17236,7 @@
opcode_t *
Parrot_lt_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17308,7 +17308,7 @@
opcode_t *
Parrot_le_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SREG(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SREG(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17316,7 +17316,7 @@
opcode_t *
Parrot_le_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SCONST(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SCONST(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17324,7 +17324,7 @@
opcode_t *
Parrot_le_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, SREG(1), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, SREG(1), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17384,7 +17384,7 @@
opcode_t *
Parrot_le_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17392,7 +17392,7 @@
opcode_t *
Parrot_le_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17468,7 +17468,7 @@
opcode_t *
Parrot_gt_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17476,7 +17476,7 @@
opcode_t *
Parrot_gt_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17552,7 +17552,7 @@
opcode_t *
Parrot_ge_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17560,7 +17560,7 @@
opcode_t *
Parrot_ge_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17670,21 +17670,21 @@
opcode_t *
Parrot_cmp_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SREG(3));
+ IREG(1) = STRING_compare(interp, SREG(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_cmp_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SCONST(2), SREG(3));
+ IREG(1) = STRING_compare(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_cmp_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SCONST(3));
+ IREG(1) = STRING_compare(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -17739,7 +17739,7 @@
Parrot_cmp_i_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
STRING* const l = VTABLE_get_string(interp, PREG(2));
- IREG(1) = Parrot_str_compare(interp, l, SREG(3));
+ IREG(1) = STRING_compare(interp, l, SREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -17747,7 +17747,7 @@
Parrot_cmp_i_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
STRING* const l = VTABLE_get_string(interp, PREG(2));
- IREG(1) = Parrot_str_compare(interp, l, SCONST(3));
+ IREG(1) = STRING_compare(interp, l, SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -17949,21 +17949,21 @@
opcode_t *
Parrot_isle_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SREG(3)) <= 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SREG(3)) <= 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isle_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SCONST(2), SREG(3)) <= 0;
+ IREG(1) = STRING_compare(interp, SCONST(2), SREG(3)) <= 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isle_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SCONST(3)) <= 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SCONST(3)) <= 0;
return (opcode_t *)cur_opcode + 4;}
@@ -18019,21 +18019,21 @@
opcode_t *
Parrot_islt_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SREG(3)) < 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SREG(3)) < 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_islt_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SCONST(2), SREG(3)) < 0;
+ IREG(1) = STRING_compare(interp, SCONST(2), SREG(3)) < 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_islt_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_compare(interp, SREG(2), SCONST(3)) < 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SCONST(3)) < 0;
return (opcode_t *)cur_opcode + 4;}
@@ -18089,21 +18089,21 @@
opcode_t *
Parrot_iseq_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_equal(interp, SREG(2), SREG(3)) ? 1 : 0);
+ IREG(1) = STRING_equal(interp, SREG(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_equal(interp, SCONST(2), SREG(3)) ? 1 : 0);
+ IREG(1) = STRING_equal(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_equal(interp, SREG(2), SCONST(3)) ? 1 : 0);
+ IREG(1) = STRING_equal(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -18162,21 +18162,21 @@
opcode_t *
Parrot_isne_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_not_equal(interp, SREG(2), SREG(3)) ? 1 : 0);
+ IREG(1) = !STRING_equal(interp, SREG(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_not_equal(interp, SCONST(2), SREG(3)) ? 1 : 0);
+ IREG(1) = !STRING_equal(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_not_equal(interp, SREG(2), SCONST(3)) ? 1 : 0);
+ IREG(1) = !STRING_equal(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22226,49 +22226,49 @@
opcode_t *
Parrot_ord_i_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = string_ord(interp, SREG(2), 0);
+ IREG(1) = STRING_ord(interp, SREG(2), 0);
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_ord_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = string_ord(interp, SCONST(2), 0);
+ IREG(1) = STRING_ord(interp, SCONST(2), 0);
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_ord_i_s_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = string_ord(interp, SREG(2), IREG(3));
+ IREG(1) = STRING_ord(interp, SREG(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ord_i_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = string_ord(interp, SCONST(2), IREG(3));
+ IREG(1) = STRING_ord(interp, SCONST(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ord_i_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = string_ord(interp, SREG(2), ICONST(3));
+ IREG(1) = STRING_ord(interp, SREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ord_i_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = string_ord(interp, SCONST(2), ICONST(3));
+ IREG(1) = STRING_ord(interp, SCONST(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_chr_s_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const s = string_chr(interp, (UINTVAL)IREG(2));
+ STRING * const s = Parrot_str_chr(interp, (UINTVAL)IREG(2));
SREG(1) = s;
return (opcode_t *)cur_opcode + 3;}
@@ -22276,7 +22276,7 @@
opcode_t *
Parrot_chr_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const s = string_chr(interp, (UINTVAL)ICONST(2));
+ STRING * const s = Parrot_str_chr(interp, (UINTVAL)ICONST(2));
SREG(1) = s;
return (opcode_t *)cur_opcode + 3;}
@@ -22537,7 +22537,7 @@
Parrot_substr_s_s_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const INTVAL len = Parrot_str_byte_length(interp, SREG(2));
- SREG(1) = Parrot_str_substr(interp, SREG(2), IREG(3), len);
+ SREG(1) = STRING_substr(interp, SREG(2), IREG(3), len);
return (opcode_t *)cur_opcode + 4;}
@@ -22545,7 +22545,7 @@
Parrot_substr_s_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const INTVAL len = Parrot_str_byte_length(interp, SCONST(2));
- SREG(1) = Parrot_str_substr(interp, SCONST(2), IREG(3), len);
+ SREG(1) = STRING_substr(interp, SCONST(2), IREG(3), len);
return (opcode_t *)cur_opcode + 4;}
@@ -22553,7 +22553,7 @@
Parrot_substr_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const INTVAL len = Parrot_str_byte_length(interp, SREG(2));
- SREG(1) = Parrot_str_substr(interp, SREG(2), ICONST(3), len);
+ SREG(1) = STRING_substr(interp, SREG(2), ICONST(3), len);
return (opcode_t *)cur_opcode + 4;}
@@ -22561,63 +22561,63 @@
Parrot_substr_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const INTVAL len = Parrot_str_byte_length(interp, SCONST(2));
- SREG(1) = Parrot_str_substr(interp, SCONST(2), ICONST(3), len);
+ SREG(1) = STRING_substr(interp, SCONST(2), ICONST(3), len);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_substr_s_s_i_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_substr(interp, SREG(2), IREG(3), IREG(4));
+ SREG(1) = STRING_substr(interp, SREG(2), IREG(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_sc_i_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_substr(interp, SCONST(2), IREG(3), IREG(4));
+ SREG(1) = STRING_substr(interp, SCONST(2), IREG(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_s_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_substr(interp, SREG(2), ICONST(3), IREG(4));
+ SREG(1) = STRING_substr(interp, SREG(2), ICONST(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_sc_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_substr(interp, SCONST(2), ICONST(3), IREG(4));
+ SREG(1) = STRING_substr(interp, SCONST(2), ICONST(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_s_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_substr(interp, SREG(2), IREG(3), ICONST(4));
+ SREG(1) = STRING_substr(interp, SREG(2), IREG(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_sc_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_substr(interp, SCONST(2), IREG(3), ICONST(4));
+ SREG(1) = STRING_substr(interp, SCONST(2), IREG(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_s_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_substr(interp, SREG(2), ICONST(3), ICONST(4));
+ SREG(1) = STRING_substr(interp, SREG(2), ICONST(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_sc_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_substr(interp, SCONST(2), ICONST(3), ICONST(4));
+ SREG(1) = STRING_substr(interp, SCONST(2), ICONST(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
@@ -22764,84 +22764,84 @@
opcode_t *
Parrot_index_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && SREG(3)) ? Parrot_str_find_index(interp, SREG(2), SREG(3), 0) : -1;
+ IREG(1) = (SREG(2) && SREG(3)) ? STRING_index(interp, SREG(2), SREG(3), 0) : -1;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_index_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SCONST(2) && SREG(3)) ? Parrot_str_find_index(interp, SCONST(2), SREG(3), 0) : -1;
+ IREG(1) = (SCONST(2) && SREG(3)) ? STRING_index(interp, SCONST(2), SREG(3), 0) : -1;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_index_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && SCONST(3)) ? Parrot_str_find_index(interp, SREG(2), SCONST(3), 0) : -1;
+ IREG(1) = (SREG(2) && SCONST(3)) ? STRING_index(interp, SREG(2), SCONST(3), 0) : -1;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_index_i_sc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SCONST(2) && SCONST(3)) ? Parrot_str_find_index(interp, SCONST(2), SCONST(3), 0) : -1;
+ IREG(1) = (SCONST(2) && SCONST(3)) ? STRING_index(interp, SCONST(2), SCONST(3), 0) : -1;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_index_i_s_s_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && SREG(3)) ? Parrot_str_find_index(interp, SREG(2), SREG(3), IREG(4)) : -1;
+ IREG(1) = (SREG(2) && SREG(3)) ? STRING_index(interp, SREG(2), SREG(3), IREG(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_sc_s_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SCONST(2) && SREG(3)) ? Parrot_str_find_index(interp, SCONST(2), SREG(3), IREG(4)) : -1;
+ IREG(1) = (SCONST(2) && SREG(3)) ? STRING_index(interp, SCONST(2), SREG(3), IREG(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_s_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && SCONST(3)) ? Parrot_str_find_index(interp, SREG(2), SCONST(3), IREG(4)) : -1;
+ IREG(1) = (SREG(2) && SCONST(3)) ? STRING_index(interp, SREG(2), SCONST(3), IREG(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_sc_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SCONST(2) && SCONST(3)) ? Parrot_str_find_index(interp, SCONST(2), SCONST(3), IREG(4)) : -1;
+ IREG(1) = (SCONST(2) && SCONST(3)) ? STRING_index(interp, SCONST(2), SCONST(3), IREG(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && SREG(3)) ? Parrot_str_find_index(interp, SREG(2), SREG(3), ICONST(4)) : -1;
+ IREG(1) = (SREG(2) && SREG(3)) ? STRING_index(interp, SREG(2), SREG(3), ICONST(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SCONST(2) && SREG(3)) ? Parrot_str_find_index(interp, SCONST(2), SREG(3), ICONST(4)) : -1;
+ IREG(1) = (SCONST(2) && SREG(3)) ? STRING_index(interp, SCONST(2), SREG(3), ICONST(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && SCONST(3)) ? Parrot_str_find_index(interp, SREG(2), SCONST(3), ICONST(4)) : -1;
+ IREG(1) = (SREG(2) && SCONST(3)) ? STRING_index(interp, SREG(2), SCONST(3), ICONST(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_sc_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SCONST(2) && SCONST(3)) ? Parrot_str_find_index(interp, SCONST(2), SCONST(3), ICONST(4)) : -1;
+ IREG(1) = (SCONST(2) && SCONST(3)) ? STRING_index(interp, SCONST(2), SCONST(3), ICONST(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
@@ -26093,12 +26093,12 @@
PARROT_FUNCTION_CORE, /* core_type = PARROT_XX_CORE */
0, /* flags */
2, /* major_version */
- 8, /* minor_version */
- 0, /* patch_version */
+ 9, /* minor_version */
+ 1, /* patch_version */
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() */
};
/*
@@ -26220,7 +26220,7 @@
hop_buckets = NULL;
}PARROT_EXPORT
op_lib_t *
-Parrot_DynOp_core_2_8_0(PARROT_INTERP, long init) {
+Parrot_DynOp_core_2_9_1(PARROT_INTERP, long init) {
/* initialize and return op_lib ptr */
if (init == 1) {
@@ -26249,7 +26249,7 @@
{
PMC *const lib = Parrot_pmc_new(interp, enum_class_ParrotLibrary);
- ((Parrot_ParrotLibrary_attributes*)PMC_data(lib))->oplib_init = (void *) Parrot_DynOp_core_2_8_0;
+ ((Parrot_ParrotLibrary_attributes*)PMC_data(lib))->oplib_init = (void *) Parrot_DynOp_core_2_9_1;
dynop_register(interp, lib);
return lib;
}
Modified: branches/html_cleanup/src/ops/string.ops
==============================================================================
--- branches/html_cleanup/src/ops/string.ops Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/ops/string.ops Sun Oct 24 12:14:32 2010 (r49645)
@@ -40,11 +40,11 @@
=cut
inline op ord(out INT, in STR) :base_core {
- $1 = string_ord(interp, $2, 0);
+ $1 = STRING_ord(interp, $2, 0);
}
inline op ord(out INT, in STR, in INT) :base_core {
- $1 = string_ord(interp, $2, $3);
+ $1 = STRING_ord(interp, $2, $3);
}
@@ -55,7 +55,7 @@
=cut
inline op chr(out STR, in INT) :base_core {
- STRING * const s = string_chr(interp, (UINTVAL)$2);
+ STRING * const s = Parrot_str_chr(interp, (UINTVAL)$2);
$1 = s;
}
@@ -252,11 +252,11 @@
inline op substr(out STR, in STR, in INT) :base_core {
const INTVAL len = Parrot_str_byte_length(interp, $2);
- $1 = Parrot_str_substr(interp, $2, $3, len);
+ $1 = STRING_substr(interp, $2, $3, len);
}
inline op substr(out STR, in STR, in INT, in INT) :base_core {
- $1 = Parrot_str_substr(interp, $2, $3, $4);
+ $1 = STRING_substr(interp, $2, $3, $4);
}
inline op substr(out STR, invar PMC, in INT, in INT) :base_core {
@@ -284,11 +284,11 @@
=cut
inline op index(out INT, in STR, in STR) :base_core {
- $1 = ($2 && $3) ? Parrot_str_find_index(interp, $2, $3, 0) : -1;
+ $1 = ($2 && $3) ? STRING_index(interp, $2, $3, 0) : -1;
}
inline op index(out INT, in STR, in STR, in INT) :base_core {
- $1 = ($2 && $3) ? Parrot_str_find_index(interp, $2, $3, $4) : -1;
+ $1 = ($2 && $3) ? STRING_index(interp, $2, $3, $4) : -1;
}
Modified: branches/html_cleanup/src/packdump.c
==============================================================================
--- branches/html_cleanup/src/packdump.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/packdump.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -193,7 +193,7 @@
Parrot_io_printf(interp, " [ 'PFC_STRING', {\n");
pobj_flag_dump(interp, (long)PObj_get_FLAGS(self));
- Parrot_io_printf(interp, " ENCODING => %ld,\n", self->encoding);
+ Parrot_io_printf(interp, " ENCODING => %s,\n", self->encoding->name);
Parrot_io_printf(interp, " SIZE => %ld,\n", self->bufused);
Parrot_io_printf(interp, " DATA => \"%Ss\"\n",
Parrot_str_escape(interp, self));
Modified: branches/html_cleanup/src/packfile.c
==============================================================================
--- branches/html_cleanup/src/packfile.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/packfile.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -1181,7 +1181,7 @@
PackFile_Segment *seg = dir->segments[i];
if (seg) {
- if (Parrot_str_equal(interp, seg->name, name))
+ if (STRING_equal(interp, seg->name, name))
return seg;
if (sub_dir && seg->type == PF_DIR_SEG) {
@@ -1223,7 +1223,7 @@
for (i = 0; i < dir->num_segments; ++i) {
PackFile_Segment * const seg = dir->segments[i];
- if (Parrot_str_equal(interp, seg->name, name)) {
+ if (STRING_equal(interp, seg->name, name)) {
dir->num_segments--;
if (i != dir->num_segments) {
@@ -2903,7 +2903,7 @@
/* find seg e.g. CODE_DB => CODE and attach it */
str_len = Parrot_str_length(interp, debug->base.name);
- code_name = Parrot_str_substr(interp, debug->base.name, 0, str_len - 3);
+ code_name = STRING_substr(interp, debug->base.name, 0, str_len - 3);
code = (PackFile_ByteCode *)PackFile_find_segment(interp, self->dir, code_name, 0);
if (!code || code->base.type != PF_BYTEC_SEG) {
@@ -3031,7 +3031,7 @@
prev_filename_n = debug->mappings[debug->num_mappings-1].filename;
filename_pstr = Parrot_str_new(interp, filename, 0);
if (ct->str.constants[prev_filename_n] &&
- Parrot_str_equal(interp, filename_pstr,
+ STRING_equal(interp, filename_pstr,
ct->str.constants[prev_filename_n])) {
return;
}
@@ -3073,7 +3073,7 @@
/* Check if there is already a constant with this filename */
for (i= 0; i < count; ++i) {
- if (Parrot_str_equal(interp, namestr, ct->str.constants[i]))
+ if (STRING_equal(interp, namestr, ct->str.constants[i]))
break;
}
if (i < count) {
@@ -3777,7 +3777,7 @@
/* Need to associate this segment with the applicable code segment. */
str_len = Parrot_str_length(interp, self->base.name);
- code_name = Parrot_str_substr(interp, self->base.name, 0, str_len - 4);
+ code_name = STRING_substr(interp, self->base.name, 0, str_len - 4);
code = (PackFile_ByteCode *)PackFile_find_segment(interp,
self->base.dir, code_name, 0);
@@ -3931,7 +3931,7 @@
for (i = 0; i < self->num_keys; ++i) {
STRING * const test_key = self->code->const_table->str.constants[self->keys[i].name];
- if (Parrot_str_equal(interp, test_key, key_name)) {
+ if (STRING_equal(interp, test_key, key_name)) {
key_id = i;
break;
}
@@ -4048,7 +4048,7 @@
if (!STRING_IS_NULL(key)) {
for (i = 0; i < self->num_keys; ++i) {
STRING * const test_key = self->code->const_table->str.constants[self->keys[i].name];
- if (Parrot_str_equal(interp, test_key, key)) {
+ if (STRING_equal(interp, test_key, key)) {
key_id = i;
break;
}
@@ -4235,7 +4235,7 @@
/* Get the base path of the located module */
parrot_split_path_ext(interp, path, &found_path, &found_ext);
name_length = Parrot_str_length(interp, lang_name);
- found_path = Parrot_str_substr(interp, found_path, 0,
+ found_path = STRING_substr(interp, found_path, 0,
Parrot_str_length(interp, found_path)-name_length);
Parrot_lib_add_path(interp, Parrot_str_concat(interp, found_path, CONST_STRING(interp, "include/")),
@@ -4249,7 +4249,7 @@
/* Check if the file found was actually a bytecode file (.pbc extension) or
* a source file (.pir or .pasm extension. */
- if (Parrot_str_equal(interp, found_ext, pbc))
+ if (STRING_equal(interp, found_ext, pbc))
file_type = PARROT_RUNTIME_FT_PBC;
else
file_type = PARROT_RUNTIME_FT_SOURCE;
@@ -4330,7 +4330,7 @@
pbc = CONST_STRING(interp, "pbc");
- if (Parrot_str_equal(interp, ext, pbc))
+ if (STRING_equal(interp, ext, pbc))
file_type = PARROT_RUNTIME_FT_PBC;
else
file_type = PARROT_RUNTIME_FT_SOURCE;
@@ -4348,7 +4348,7 @@
/* Check if the file found was actually a bytecode file (.pbc
* extension) or a source file (.pir or .pasm extension). */
- if (Parrot_str_equal(interp, found_ext, pbc))
+ if (STRING_equal(interp, found_ext, pbc))
file_type = PARROT_RUNTIME_FT_PBC;
else
file_type = PARROT_RUNTIME_FT_SOURCE;
Modified: branches/html_cleanup/src/packout.c
==============================================================================
--- branches/html_cleanup/src/packout.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/packout.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -273,7 +273,7 @@
for (i = 0; i < ct->str.const_count; i++) {
STRING *sc = ct->str.constants[i];
- if (Parrot_str_equal(interp, s, sc)
+ if (STRING_equal(interp, s, sc)
&& s->encoding == sc->encoding) {
return i;
}
Modified: branches/html_cleanup/src/pmc.c
==============================================================================
--- branches/html_cleanup/src/pmc.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -996,7 +996,7 @@
do {
INTVAL len;
- const INTVAL idx = Parrot_str_find_index(interp, what, role, (INTVAL)pos);
+ const INTVAL idx = STRING_index(interp, what, role, pos);
if ((idx < 0) || (idx >= length))
return 0;
@@ -1004,14 +1004,14 @@
pos = idx;
len = Parrot_str_byte_length(interp, role);
- if (pos && (Parrot_str_indexed(interp, what, pos - 1) != 32)) {
+ if (pos && (STRING_ord(interp, what, pos - 1) != 32)) {
pos += len;
continue;
}
if (pos + len < length) {
pos += len;
- if (Parrot_str_indexed(interp, what, pos) != 32)
+ if (STRING_ord(interp, what, pos) != 32)
continue;
}
Modified: branches/html_cleanup/src/pmc/addrregistry.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/addrregistry.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/addrregistry.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -32,7 +32,10 @@
/* HEADERIZER BEGIN: static */
/* HEADERIZER END: static */
-pmclass AddrRegistry extends Hash provides hash auto_attrs {
+pmclass AddrRegistry provides hash auto_attrs {
+ATTR Hash *pmc_registry;
+ATTR Hash *str_registry;
+
/*
=item C<void init()>
@@ -44,17 +47,71 @@
*/
VTABLE void init() {
- Hash *registry = parrot_create_hash(INTERP,
+ Hash *pmc_registry = parrot_create_hash(INTERP,
enum_type_int,
Hash_key_type_PMC_ptr);
- SET_ATTR_hash(INTERP, SELF, registry);
+ Hash *str_registry = parrot_create_hash(INTERP,
+ enum_type_int,
+ Hash_key_type_STRING);
+
+ SET_ATTR_pmc_registry(INTERP, SELF, pmc_registry);
+ SET_ATTR_str_registry(INTERP, SELF, str_registry);
PObj_custom_mark_destroy_SETALL(SELF);
}
/*
+=item C<void mark()>
+
+Mark any PMCs and STRINGs in this registry.
+
+=cut
+
+*/
+
+
+ VTABLE void mark() {
+ Hash *str_registry, *pmc_registry;
+
+ GET_ATTR_str_registry(INTERP, SELF, str_registry);
+ GET_ATTR_pmc_registry(INTERP, SELF, pmc_registry);
+
+ parrot_mark_hash(interp, pmc_registry);
+ parrot_mark_hash(interp, str_registry);
+
+ }
+
+
+/*
+
+=item C<void destroy()>
+
+Destroy this PMC.
+
+=cut
+
+*/
+
+ VTABLE void destroy() {
+ Hash *str_registry, *pmc_registry;
+
+ GET_ATTR_str_registry(INTERP, SELF, str_registry);
+ GET_ATTR_pmc_registry(INTERP, SELF, pmc_registry);
+
+ parrot_hash_destroy(interp, pmc_registry);
+ parrot_hash_destroy(interp, str_registry);
+
+ SET_ATTR_str_registry(INTERP, SELF, NULL);
+ SET_ATTR_pmc_registry(INTERP, SELF, NULL);
+
+ }
+
+
+
+/*
+
=item C<INTVAL get_integer_keyed(PMC *key)>
Returns the reference count for C<key> or 0 if the key doesn't exist.
@@ -75,7 +132,7 @@
Hash *hash;
const void *value;
- GET_ATTR_hash(INTERP, SELF, hash);
+ GET_ATTR_pmc_registry(INTERP, SELF, hash);
value = parrot_hash_get(INTERP, hash, key);
if (value)
@@ -85,19 +142,23 @@
}
VTABLE INTVAL elements() {
- const Hash *hash;
+ const Hash *pmc_registry, *str_registry;
- GET_ATTR_hash(INTERP, SELF, hash);
+ GET_ATTR_pmc_registry(INTERP, SELF, pmc_registry);
+ GET_ATTR_str_registry(INTERP, SELF, str_registry);
- return parrot_hash_size(INTERP, hash);
+ return parrot_hash_size(INTERP, pmc_registry) +
+ parrot_hash_size(INTERP, str_registry);
}
VTABLE INTVAL get_bool() {
- const Hash *hash;
+ const Hash *pmc_registry, *str_registry;
- GET_ATTR_hash(INTERP, SELF, hash);
+ GET_ATTR_pmc_registry(INTERP, SELF, pmc_registry);
+ GET_ATTR_str_registry(INTERP, SELF, str_registry);
- return parrot_hash_size(INTERP, hash) != 0;
+ return (parrot_hash_size(INTERP, pmc_registry) +
+ parrot_hash_size(INTERP, str_registry)) != 0;
}
/*
@@ -112,6 +173,8 @@
=item C<void delete_keyed(PMC *key)>
+=item C<void delete_keyed_str(STRING *key)>
+
Decrement the reference count of C<key>. If the reference count
reaches 0, delete the entry.
@@ -126,7 +189,23 @@
Hash *hash;
UNUSED(value);
- GET_ATTR_hash(INTERP, SELF, hash);
+ GET_ATTR_pmc_registry(INTERP, SELF, hash);
+
+ oldval = parrot_hash_get(INTERP, hash, key);
+
+ if (oldval)
+ newval += (long)oldval;
+
+ parrot_hash_put(INTERP, hash, key, (void *)newval);
+ }
+
+ VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) {
+ const void *oldval;
+ long newval = 1;
+ Hash *hash;
+ UNUSED(value);
+
+ GET_ATTR_str_registry(INTERP, SELF, hash);
oldval = parrot_hash_get(INTERP, hash, key);
@@ -138,7 +217,7 @@
VTABLE void set_integer_keyed(PMC *key, INTVAL value) {
Hash *hash;
- GET_ATTR_hash(INTERP, SELF, hash);
+ GET_ATTR_pmc_registry(INTERP, SELF, hash);
parrot_hash_put(INTERP, hash, key, (void *)value);
}
@@ -146,7 +225,26 @@
Hash *hash;
void *value;
- GET_ATTR_hash(INTERP, SELF, hash);
+ GET_ATTR_pmc_registry(INTERP, SELF, hash);
+ value = parrot_hash_get(INTERP, hash, key);
+
+ /* these casts look bad, but they avoid type punning warnings with -O */
+ if (value) {
+ long val = (long)value;
+ if (val == 1L)
+ parrot_hash_delete(INTERP, hash, key);
+ else {
+ value = (void *)(--val);
+ parrot_hash_put(INTERP, hash, key, value);
+ }
+ }
+ }
+
+ VTABLE void delete_keyed_str(STRING *key) {
+ Hash *hash;
+ void *value;
+
+ GET_ATTR_str_registry(INTERP, SELF, hash);
value = parrot_hash_get(INTERP, hash, key);
/* these casts look bad, but they avoid type punning warnings with -O */
Modified: branches/html_cleanup/src/pmc/bytebuffer.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/bytebuffer.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/bytebuffer.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -71,6 +71,9 @@
VTABLE void init_int(INTVAL initial_size) {
unsigned char *content;
+ if (initial_size < 0)
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
+ _("ByteBuffer: Cannot set buffer size to a negative number (%d)"), initial_size);
STATICSELF.init();
SET_ATTR_size(INTERP, SELF, initial_size);
SET_ATTR_allocated_size(INTERP, SELF, initial_size);
Modified: branches/html_cleanup/src/pmc/callcontext.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/callcontext.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/callcontext.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -505,39 +505,38 @@
pmclass CallContext provides array provides hash auto_attrs {
/* Context attributes */
- ATTR PMC *caller_ctx; /* caller context */
+ ATTR PMC *caller_ctx; /* caller context */
- ATTR void *registers; /* pointer to allocated registers */
- ATTR Regs_ni bp; /* pointers to FLOATVAL & INTVAL */
- ATTR Regs_ps bp_ps; /* pointers to PMC & STR */
-
- ATTR UINTVAL n_regs_used[4]; /* INSP in PBC points to Sub */
- ATTR PMC *lex_pad; /* LexPad PMC */
- ATTR PMC *outer_ctx; /* outer context, if a closure */
+ ATTR void *registers; /* pointer to allocated registers */
+ ATTR Regs_ni bp; /* pointers to FLOATVAL & INTVAL */
+ ATTR Regs_ps bp_ps; /* pointers to PMC & STR */
+
+ ATTR UINTVAL n_regs_used[4]; /* INSP in PBC points to Sub */
+ ATTR PMC *lex_pad; /* LexPad PMC */
+ ATTR PMC *outer_ctx; /* outer context, if a closure */
/* new call scheme and introspective variables */
- ATTR PMC *current_sub; /* the Sub we are executing */
+ ATTR PMC *current_sub; /* the Sub we are executing */
/* for now use a return continuation PMC */
- ATTR PMC *handlers; /* local handlers for the context */
- ATTR PMC *current_cont; /* the return continuation PMC */
- ATTR PMC *current_object; /* current object if a method call */
- ATTR PMC *current_namespace; /* The namespace we're currently in */
- ATTR opcode_t *current_pc; /* program counter of Sub invocation */
- ATTR PMC *current_sig; /* temporary CallContext PMC for active call */
+ ATTR PMC *handlers; /* local handlers for the context */
+ ATTR PMC *current_cont; /* the return continuation PMC */
+ ATTR PMC *current_object; /* current object if a method call */
+ ATTR PMC *current_namespace; /* The namespace we're currently in */
+ ATTR opcode_t *current_pc; /* program counter of Sub invocation */
+ ATTR PMC *current_sig; /* temporary CallContext PMC for active call */
/* deref the constants - we need them all the time */
ATTR FLOATVAL *num_constants;
ATTR STRING **str_constants;
ATTR PMC **pmc_constants;
- ATTR INTVAL current_HLL; /* see also src/hll.c */
+ ATTR INTVAL current_HLL; /* see also src/hll.c */
- ATTR UINTVAL warns; /* Keeps track of what warnings
- * have been activated */
- ATTR UINTVAL errors; /* fatals that can be turned off */
- ATTR UINTVAL trace_flags;
- ATTR UINTVAL recursion_depth; /* Sub call recursion depth */
+ ATTR UINTVAL warns; /* Keeps track of activated warnings */
+ ATTR UINTVAL errors; /* fatals that can be turned off */
+ ATTR UINTVAL trace_flags;
+ ATTR UINTVAL recursion_depth; /* Sub call recursion depth */
/* Storage for arguments */
ATTR struct Pcc_cell *positionals; /* array of positionals */
@@ -887,10 +886,10 @@
VTABLE void set_attr_str(STRING *key, PMC *value) {
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) {
SET_ATTR_arg_flags(INTERP, SELF, value);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "return_flags"))) {
SET_ATTR_return_flags(INTERP, SELF, value);
}
else
@@ -966,34 +965,34 @@
PMC *value = PMCNULL;
INTVAL hll;
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "named")))
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "named")))
value = get_named_names(INTERP, SELF);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags")))
GET_ATTR_arg_flags(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "return_flags")))
GET_ATTR_return_flags(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "caller_ctx")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "caller_ctx")))
GET_ATTR_caller_ctx(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "lex_pad")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "lex_pad")))
GET_ATTR_lex_pad(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "outer_ctx")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "outer_ctx")))
GET_ATTR_outer_ctx(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_sub")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_sub")))
GET_ATTR_current_sub(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_cont")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_cont")))
GET_ATTR_current_cont(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_object")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_object")))
GET_ATTR_current_object(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_namespace")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_namespace")))
GET_ATTR_current_namespace(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "handlers")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "handlers")))
GET_ATTR_handlers(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_HLL"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_HLL"))) {
GET_ATTR_current_HLL(INTERP, SELF, hll);
value = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
VTABLE_set_integer_native(interp, value, hll);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_hll"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_hll"))) {
GET_ATTR_current_HLL(INTERP, SELF, hll);
value = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_String));
VTABLE_set_string_native(interp, value, Parrot_get_HLL_name(INTERP, hll));
Modified: branches/html_cleanup/src/pmc/class.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/class.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/class.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -1112,39 +1112,39 @@
/* What should we return? */
PMC *found;
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
found = _class->attrib_metadata;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "parents"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "parents"))) {
found = _class->parents;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
found = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, found, _class->name);
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "id"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "id"))) {
found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer, _class->id);
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
/* Should not clone this. */
return _class->_namespace;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attrib_index"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "attrib_index"))) {
found = _class->attrib_index;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
found = _class->methods;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
found = _class->vtable_overrides;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "all_parents"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "all_parents"))) {
found = _class->all_parents;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
found = _class->roles;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "flags"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "flags"))) {
found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
(INTVAL)PObj_get_FLAGS(SELF));
}
@@ -1479,7 +1479,7 @@
PMC *want_class;
/* hard-code this one exception right away */
- if (Parrot_str_equal(INTERP, classname, CONST_STRING(INTERP, "Class")))
+ if (STRING_equal(INTERP, classname, CONST_STRING(INTERP, "Class")))
return 1;
want_class = Parrot_oo_get_class_str(INTERP, classname);
Modified: branches/html_cleanup/src/pmc/codestring.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/codestring.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/codestring.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -115,11 +115,11 @@
while (pos >= 0) {
pos += replen;
- pos = Parrot_str_find_index(INTERP, fmt, percent, pos);
+ pos = STRING_index(INTERP, fmt, percent, pos);
if (pos < 0)
break;
- key = Parrot_str_substr(INTERP, fmt, pos+1, 1);
+ key = STRING_substr(INTERP, fmt, pos+1, 1);
if (VTABLE_exists_keyed_str(INTERP, hash, key)) {
repl = VTABLE_get_string_keyed_str(INTERP, hash, key);
@@ -128,10 +128,10 @@
const INTVAL I0 = Parrot_str_to_int(INTERP, key);
repl = VTABLE_get_string_keyed_int(INTERP, args, I0);
}
- else if (Parrot_str_equal(INTERP, key, comma)) {
+ else if (STRING_equal(INTERP, key, comma)) {
repl = Parrot_str_join(INTERP, comma_space, args);
}
- else if (Parrot_str_equal(INTERP, key, percent)) {
+ else if (STRING_equal(INTERP, key, percent)) {
repl = percent;
}
else {
@@ -151,7 +151,8 @@
VTABLE_set_string_keyed_int(INTERP, parts, 1, fmt);
/* Add a newline if necessary */
- if ('\n' != Parrot_str_indexed(INTERP, fmt, Parrot_str_length(INTERP, fmt) - 1))
+ if (STRING_length(fmt) > 0
+ && '\n' != STRING_ord(INTERP, fmt, -1))
VTABLE_set_string_keyed_int(INTERP, parts, 2, newline);
S1 = Parrot_str_join(INTERP, STRINGNULL, parts);
@@ -199,8 +200,8 @@
/* treat \r\n as a single newline */
if (jpos < eos
- && string_ord(INTERP, str, jpos - 1) == 13
- && string_ord(INTERP, str, jpos) == 10) {
+ && STRING_ord(INTERP, str, jpos - 1) == 13
+ && STRING_ord(INTERP, str, jpos) == 10) {
++jpos;
}
/* search for the next newline */
@@ -276,14 +277,14 @@
escaped_str = Parrot_str_concat(INTERP, quote, escaped_str);
escaped_str = Parrot_str_concat(INTERP, escaped_str, quote);
- x_pos = Parrot_str_find_index(INTERP, escaped_str, x, 0);
+ x_pos = STRING_index(INTERP, escaped_str, x, 0);
if (x_pos != -1) {
is_unicode = 1;
}
else {
STRING * const u = CONST_STRING(INTERP, "\\u");
- const INTVAL u_pos = Parrot_str_find_index(INTERP, escaped_str, u, 0);
+ const INTVAL u_pos = STRING_index(INTERP, escaped_str, u, 0);
if (u_pos != -1)
is_unicode = 1;
}
Modified: branches/html_cleanup/src/pmc/complex.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/complex.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/complex.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -501,10 +501,10 @@
VTABLE FLOATVAL get_number_keyed_str(STRING *key) {
FLOATVAL value;
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
GET_ATTR_re(INTERP, SELF, value);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
GET_ATTR_im(INTERP, SELF, value);
}
else
@@ -687,10 +687,10 @@
}
VTABLE void set_number_keyed_str(STRING *key, FLOATVAL value) {
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
SET_ATTR_re(INTERP, SELF, value);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
SET_ATTR_im(INTERP, SELF, value);
}
else
Modified: branches/html_cleanup/src/pmc/default.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/default.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/default.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -197,9 +197,9 @@
ASSERT_ARGS(check_set_std_props)
/*
- * s2 in Parrot_str_equal is freed here
+ * s2 in STRING_equal is freed here
*/
- if (Parrot_str_equal(interp, key, CONST_STRING(interp, "_ro"))) {
+ if (STRING_equal(interp, key, CONST_STRING(interp, "_ro"))) {
/* pmc should set/clear readonly */
const INTVAL on = VTABLE_get_bool(interp, value);
@@ -286,7 +286,7 @@
ASSERT_ARGS(check_get_std_props)
if ((self->vtable->flags & (VTABLE_IS_CONST_FLAG | VTABLE_IS_READONLY_FLAG))
- && Parrot_str_equal(interp, key, CONST_STRING(interp, "_ro"))) {
+ && STRING_equal(interp, key, CONST_STRING(interp, "_ro"))) {
PMC * const ret_val = Parrot_pmc_new_init_int(interp,
enum_class_Integer, 1);
return ret_val;
@@ -795,9 +795,9 @@
*/
- INTVAL hashvalue() {
+ VTABLE INTVAL hashvalue() {
STRING *s = SELF.get_string();
- return Parrot_str_to_hashval(INTERP, s);
+ return STRING_hash(INTERP, s, INTERP->hash_seed);
}
/*
@@ -1003,7 +1003,7 @@
else {
const Hash * const isa_hash = SELF->vtable->isa_hash;
if (!isa_hash)
- return Parrot_str_equal(INTERP, SELF->vtable->whoami, _class);
+ return STRING_equal(INTERP, SELF->vtable->whoami, _class);
return parrot_hash_exists(INTERP, isa_hash, (void *)_class);
}
@@ -1020,12 +1020,12 @@
*/
VTABLE PMC *inspect_str(STRING *name) {
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "flags"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "flags"))) {
PMC *found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
(INTVAL)PObj_get_FLAGS(SELF));
return found;
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "mro"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "mro"))) {
return VTABLE_clone(INTERP, SELF->vtable->mro);
}
else
Modified: branches/html_cleanup/src/pmc/eventhandler.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/eventhandler.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/eventhandler.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -217,7 +217,7 @@
Parrot_EventHandler_attributes * const e = PARROT_EVENTHANDLER(SELF);
PMC *value = PMCNULL;
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
value = e->code;
}
@@ -277,12 +277,12 @@
PMC * const type = VTABLE_get_attr_str(INTERP, event, CONST_STRING(INTERP, "type"));
STRING * const type_str = VTABLE_get_string(INTERP, type);
- if (Parrot_str_equal(INTERP, type_str, CONST_STRING(INTERP, "event"))) {
+ if (STRING_equal(INTERP, type_str, CONST_STRING(INTERP, "event"))) {
Parrot_EventHandler_attributes * const handler_struct = PARROT_EVENTHANDLER(SELF);
PMC * const subtype = VTABLE_get_attr_str(INTERP, event, CONST_STRING(INTERP, "subtype"));
STRING * const subtype_str = VTABLE_get_string(INTERP, subtype);
- if (Parrot_str_equal(INTERP, subtype_str, handler_struct->type)) {
+ if (STRING_equal(INTERP, subtype_str, handler_struct->type)) {
RETURN(INTVAL 1);
}
}
Modified: branches/html_cleanup/src/pmc/exception.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/exception.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/exception.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -287,7 +287,7 @@
STRING * const name = VTABLE_get_string(INTERP, key);
STRING *message;
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
message = SELF.get_string();
}
else {
@@ -421,7 +421,7 @@
VTABLE void set_string_keyed(PMC *key, STRING *value) {
STRING * const name = VTABLE_get_string(INTERP, key);
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
SELF.set_string_native(value);
}
else {
@@ -844,29 +844,29 @@
ASSERT_ARGS(getAttrEnum)
AttrEnum r;
- if (Parrot_str_equal(interp, name, CONST_STRING(interp, "birthtime")))
+ if (STRING_equal(interp, name, CONST_STRING(interp, "birthtime")))
r = attr_birthtime;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "message")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "message")))
r = attr_message;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "payload")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "payload")))
r = attr_payload;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "resume")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "resume")))
r = attr_resume;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "severity")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "severity")))
r = attr_severity;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "type")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "type")))
r = attr_type;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "exit_code")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "exit_code")))
r = attr_exit_code;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "backtrace")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "backtrace")))
r = attr_backtrace;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "handled")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "handled")))
r = attr_handled;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "handler_iter")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "handler_iter")))
r = attr_handler_iter;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "handler_ctx")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "handler_ctx")))
r = attr_handler_ctx;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "thrower")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "thrower")))
r = attr_thrower;
else
r = attr_NONE;
Modified: branches/html_cleanup/src/pmc/filehandle.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/filehandle.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/filehandle.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -584,11 +584,11 @@
INTVAL flags;
if (got_type) {
- if (Parrot_str_equal(INTERP, new_type, nobuffer_string))
+ if (STRING_equal(INTERP, new_type, nobuffer_string))
Parrot_io_setbuf(INTERP, SELF, PIOCTL_NONBUF);
- else if (Parrot_str_equal(INTERP, new_type, linebuffer_string))
+ else if (STRING_equal(INTERP, new_type, linebuffer_string))
Parrot_io_setlinebuf(INTERP, SELF);
- else if (Parrot_str_equal(INTERP, new_type, fullbuffer_string))
+ else if (STRING_equal(INTERP, new_type, fullbuffer_string))
Parrot_io_setbuf(INTERP, SELF, PIO_UNBOUND);
}
Modified: branches/html_cleanup/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/fixedbooleanarray.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/fixedbooleanarray.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -274,7 +274,7 @@
VTABLE STRING *get_string() {
STRING *zero, *one;
- STRING *str = NULL;
+ STRING *str = STRINGNULL;
UINTVAL i;
UINTVAL elems = SELF.elements();
Modified: branches/html_cleanup/src/pmc/fixedstringarray.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/fixedstringarray.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/fixedstringarray.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -571,7 +571,7 @@
if (STRING_IS_NULL(item1) || STRING_IS_NULL(item2))
return 0;
- if (!Parrot_str_equal(INTERP, item1, item2))
+ if (!STRING_equal(INTERP, item1, item2))
return 0;
}
Modified: branches/html_cleanup/src/pmc/lexinfo.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/lexinfo.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/lexinfo.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -95,7 +95,7 @@
*/
VTABLE PMC *inspect_str(STRING *what) {
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "symbols"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "symbols"))) {
PMC * const result = Parrot_pmc_new(INTERP, enum_class_ResizableStringArray);
const Hash *hash = (Hash *)SELF.get_pointer();
Modified: branches/html_cleanup/src/pmc/namespace.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/namespace.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/namespace.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -182,7 +182,7 @@
if (sub->comp_flags & SUB_COMP_FLAG_METHOD) {
STRING *method_name = key;
- if (Parrot_str_equal(interp, sub->method_name, CONST_STRING(interp, ""))) {
+ if (STRING_equal(interp, sub->method_name, CONST_STRING(interp, ""))) {
if (sub->vtable_index != -1 && !STRING_IS_NULL(vtable_key)) {
method_name = vtable_key;
}
@@ -287,7 +287,7 @@
STRING *method_name = key;
Hash *hash;
- if (Parrot_str_not_equal(interp, sub->method_name, empty_str))
+ if (!STRING_equal(interp, sub->method_name, empty_str))
method_name = sub->method_name;
add_to_class(interp, nsinfo, classobj, method_name, value);
@@ -731,13 +731,13 @@
const Parrot_NameSpace_attributes * const nsinfo = PARROT_NAMESPACE(SELF);
PMC *found;
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
found = nsinfo->methods;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
found = nsinfo->vtable;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "class"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "class"))) {
found = nsinfo->_class;
}
else
Modified: branches/html_cleanup/src/pmc/nci.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/nci.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/nci.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -78,7 +78,7 @@
size_t i;
for (i = 0; i < sig_length; ++i) {
- const INTVAL c = Parrot_str_indexed(interp, sig, i);
+ const INTVAL c = STRING_ord(interp, sig, i);
PARROT_ASSERT(j < buf_length - 1);
Modified: branches/html_cleanup/src/pmc/object.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/object.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/object.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -678,7 +678,7 @@
VTABLE INTVAL isa(STRING *classname) {
if (SELF->vtable->whoami == classname
- || Parrot_str_equal(INTERP, SELF->vtable->whoami, classname))
+ || STRING_equal(INTERP, SELF->vtable->whoami, classname))
return 1;
else {
PMC *_class = PARROT_OBJECT(SELF)->_class;
Modified: branches/html_cleanup/src/pmc/packfile.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/packfile.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/packfile.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -316,7 +316,7 @@
*/
VTABLE STRING *get_string_keyed_str(STRING *key) {
- if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "uuid")))
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "uuid")))
return PARROT_PACKFILE(SELF)->uuid;
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
@@ -431,7 +431,7 @@
*/
VTABLE void set_string_keyed_str(STRING *key, STRING *value) {
- if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "uuid"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "uuid"))) {
PARROT_PACKFILE(SELF)->uuid = value;
return;
}
@@ -532,23 +532,23 @@
ASSERT_ARGS(getAttrEnum)
AttrEnumPackfile r;
- if (Parrot_str_equal(interp, name, CONST_STRING(interp, "wordsize")))
+ if (STRING_equal(interp, name, CONST_STRING(interp, "wordsize")))
r = attr_wordsize;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "byteorder")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "byteorder")))
r = attr_byteorder;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "fptype")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "fptype")))
r = attr_fptype;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_major")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "version_major")))
r = attr_version_major;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_minor")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "version_minor")))
r = attr_version_minor;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_patch")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "version_patch")))
r = attr_version_patch;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "bytecode_major")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "bytecode_major")))
r = attr_bytecode_major;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "bytecode_minor")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "bytecode_minor")))
r = attr_bytecode_minor;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "uuid_type")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "uuid_type")))
r = attr_uuid_type;
else
r = attr_NONE;
Modified: branches/html_cleanup/src/pmc/packfileconstanttable.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/packfileconstanttable.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/packfileconstanttable.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -318,7 +318,7 @@
for (i=0; i < num; ++i) {
STRING * const str = VTABLE_get_string_keyed_int(INTERP, attrs->str_constants, i);
- if (Parrot_str_equal(INTERP, value, str))
+ if (STRING_equal(INTERP, value, str))
return i;
}
Modified: branches/html_cleanup/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/parrotinterpreter.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/parrotinterpreter.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -465,12 +465,12 @@
PMC *ctx;
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return INTERP->root_namespace;
name = CONST_STRING(INTERP, "outer");
- if (Parrot_str_equal(INTERP, item, name)) {
+ if (STRING_equal(INTERP, item, name)) {
outer = item;
nextkey = key_next(INTERP, key);
@@ -522,32 +522,32 @@
name = CONST_STRING(INTERP, "context");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return ctx;
name = CONST_STRING(INTERP, "sub");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return Parrot_pcc_get_sub(INTERP, ctx);
name = CONST_STRING(INTERP, "lexpad");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return Parrot_pcc_get_lex_pad(INTERP, ctx);
name = CONST_STRING(INTERP, "namespace");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return Parrot_pcc_get_namespace(INTERP, ctx);
name = CONST_STRING(INTERP, "continuation");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return VTABLE_clone(INTERP, Parrot_pcc_get_continuation(INTERP, ctx));
name = CONST_STRING(INTERP, "annotations");
- if (Parrot_str_equal(INTERP, item, name)) {
+ if (STRING_equal(INTERP, item, name)) {
PMC *sub_pmc = Parrot_pcc_get_sub(INTERP, ctx);
if (ctx == CURRENT_CONTEXT(INTERP)) {
/* We can't know the current program counter for the currently
Modified: branches/html_cleanup/src/pmc/pmcproxy.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/pmcproxy.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/pmcproxy.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -119,7 +119,7 @@
PMC *pclass = VTABLE_get_pmc_keyed_int(INTERP, INTERP->vtables[type_num]->mro, i);
PMC *cns = pclass->vtable->_namespace;
STRING *cname = pclass->vtable->whoami;
- if (Parrot_str_not_equal(INTERP, cname, CONST_STRING(INTERP, "scalar"))) {
+ if (!STRING_equal(INTERP, cname, CONST_STRING(INTERP, "scalar"))) {
PMC *pproxy = Parrot_oo_get_class(INTERP, cns);
VTABLE_push_pmc(INTERP, proxy_info->all_parents, pproxy);
}
@@ -217,7 +217,7 @@
classname = VTABLE_get_string(INTERP, classobj);
/* Check if the passed name is the same as the stored short name. */
- if (Parrot_str_equal(INTERP, classname, _proxy->name))
+ if (STRING_equal(INTERP, classname, _proxy->name))
return 1;
/* Check if the class object is the same as self's class object */
@@ -225,7 +225,7 @@
return 1;
/* Check if the passed name is the same as the fully qualified name. */
- if (Parrot_str_equal(INTERP, classname, VTABLE_get_string(INTERP, SELF)))
+ if (STRING_equal(INTERP, classname, VTABLE_get_string(INTERP, SELF)))
return 1;
/* Look in the isa hash. */
@@ -265,7 +265,7 @@
Parrot_Class_attributes * const _proxy = PARROT_CLASS(SELF);
const STRING * const pmc_proxy = CONST_STRING(INTERP, "PMCProxy");
- if (Parrot_str_equal(INTERP, classname, pmc_proxy))
+ if (STRING_equal(INTERP, classname, pmc_proxy))
return 1;
if (SUPER(classname))
@@ -275,7 +275,7 @@
if (INTERP->vtables[_proxy->id]) {
Hash *isa_hash = INTERP->vtables[_proxy->id]->isa_hash;
- if (!isa_hash && Parrot_str_equal(INTERP,
+ if (!isa_hash && STRING_equal(INTERP,
INTERP->vtables[_proxy->id]->whoami, classname)) {
return 1;
}
Modified: branches/html_cleanup/src/pmc/role.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/role.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/role.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -416,21 +416,21 @@
/* What should we return? */
PMC *found;
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
found = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, found, role->name);
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
/* Don't clone the namespace, as it's not part of our state. */
return role->_namespace;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
found = role->attrib_metadata;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
found = role->methods;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
found = role->roles;
}
else {
@@ -541,7 +541,7 @@
Parrot_Role_attributes * const role = PARROT_ROLE(SELF);
INTVAL i, count;
- if (Parrot_str_equal(INTERP, role->name, role_name))
+ if (STRING_equal(INTERP, role->name, role_name))
return 1;
count = VTABLE_elements(INTERP, role->roles);
Modified: branches/html_cleanup/src/pmc/scalar.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/scalar.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/scalar.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -753,7 +753,7 @@
*/
MULTI INTVAL cmp_string(PMC *value) {
- return Parrot_str_compare(INTERP, SELF.get_string(),
+ return STRING_compare(INTERP, SELF.get_string(),
VTABLE_get_string(INTERP, value));
}
@@ -800,7 +800,7 @@
*/
MULTI INTVAL is_equal_string(PMC *value) {
- return (0 != Parrot_str_equal(INTERP, VTABLE_get_string(INTERP, SELF),
+ return (0 != STRING_equal(INTERP, VTABLE_get_string(INTERP, SELF),
VTABLE_get_string(INTERP, value)));
}
@@ -831,7 +831,7 @@
*/
VTABLE STRING *substr_str(INTVAL offset, INTVAL length) {
- return Parrot_str_substr(INTERP, VTABLE_get_string(INTERP, SELF),
+ return STRING_substr(INTERP, VTABLE_get_string(INTERP, SELF),
offset, length);
}
Modified: branches/html_cleanup/src/pmc/scheduler.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/scheduler.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/scheduler.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -420,12 +420,12 @@
for (index = 0; index < elements; ++index) {
const PMC * const handler = VTABLE_get_pmc_keyed_int(INTERP, handlers, index);
if (!PMC_IS_NULL(handler)) {
- if (Parrot_str_equal(INTERP, type, except_str)
+ if (STRING_equal(INTERP, type, except_str)
&& handler->vtable->base_type == enum_class_ExceptionHandler) {
VTABLE_set_pmc_keyed_int(INTERP, handlers, index, PMCNULL);
RETURN(void);
}
- else if (Parrot_str_equal(INTERP, type, event_str)
+ else if (STRING_equal(INTERP, type, event_str)
&& handler->vtable->base_type == enum_class_EventHandler) {
VTABLE_set_pmc_keyed_int(INTERP, handlers, index, PMCNULL);
RETURN(void);
@@ -520,9 +520,9 @@
STRING * const event = CONST_STRING(INTERP, "event");
if (!PMC_IS_NULL(handler)) {
- if ((Parrot_str_equal(INTERP, type, exception)
+ if ((STRING_equal(INTERP, type, exception)
&& handler->vtable->base_type == enum_class_ExceptionHandler)
- || (Parrot_str_equal(INTERP, type, event)
+ || (STRING_equal(INTERP, type, event)
&& handler->vtable->base_type == enum_class_EventHandler))
++count;
}
Modified: branches/html_cleanup/src/pmc/socket.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/socket.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/socket.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -66,7 +66,7 @@
data_struct->local = VTABLE_clone(INTERP, old_struct->local);
data_struct->remote = VTABLE_clone(INTERP, old_struct->remote);
- return SELF;
+ return copy;
}
/*
Modified: branches/html_cleanup/src/pmc/string.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/string.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/string.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -243,7 +243,7 @@
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return (INTVAL)(Parrot_str_equal(INTERP, str_val, v));
+ return (INTVAL)(STRING_equal(INTERP, str_val, v));
}
MULTI INTVAL is_equal(PMC *value) {
@@ -286,7 +286,7 @@
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return Parrot_str_equal(INTERP, str_val, v);
+ return STRING_equal(INTERP, str_val, v);
}
/*
@@ -304,7 +304,7 @@
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return Parrot_str_compare(INTERP, str_val, v);
+ return STRING_compare(INTERP, str_val, v);
}
/*
@@ -349,7 +349,7 @@
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return Parrot_str_compare(INTERP, str_val, v);
+ return STRING_compare(INTERP, str_val, v);
}
/*
@@ -365,7 +365,7 @@
VTABLE void substr(INTVAL offset, INTVAL length, PMC *dest) {
STRING *str_val, *s2;
GET_ATTR_str_val(INTERP, SELF, str_val);
- s2 = Parrot_str_substr(INTERP, str_val, offset, length);
+ s2 = STRING_substr(INTERP, str_val, offset, length);
VTABLE_set_string_native(INTERP, dest, s2);
}
@@ -382,7 +382,7 @@
VTABLE STRING *substr_str(INTVAL offset, INTVAL length) {
STRING *str_val;
GET_ATTR_str_val(INTERP, SELF, str_val);
- return Parrot_str_substr(INTERP, str_val, offset, length);
+ return STRING_substr(INTERP, str_val, offset, length);
}
/*
@@ -437,7 +437,7 @@
VTABLE STRING *get_string_keyed_int(INTVAL pos) {
STRING *str_val;
GET_ATTR_str_val(INTERP, SELF, str_val);
- return Parrot_str_substr(INTERP, str_val, pos, 1);
+ return STRING_substr(INTERP, str_val, pos, 1);
}
VTABLE INTVAL get_integer_keyed(PMC *key) {
@@ -447,7 +447,7 @@
VTABLE INTVAL get_integer_keyed_int(INTVAL pos) {
STRING *str_val;
GET_ATTR_str_val(INTERP, SELF, str_val);
- return string_ord(INTERP, str_val, pos);
+ return STRING_ord(INTERP, str_val, pos);
}
VTABLE PMC *get_pmc_keyed(PMC *key) {
@@ -478,7 +478,7 @@
VTABLE void set_integer_keyed_int(INTVAL pos, INTVAL value) {
STRING *str_val;
- STRING * const c = string_chr(INTERP, (UINTVAL) value);
+ STRING * const c = Parrot_str_chr(INTERP, (UINTVAL) value);
GET_ATTR_str_val(INTERP, SELF, str_val);
str_val = Parrot_str_replace(INTERP, str_val, pos, 1, c);
SET_ATTR_str_val(INTERP, SELF, str_val);
@@ -507,7 +507,7 @@
STRING * s = VTABLE_get_string(INTERP, SELF);
INTVAL i = 0;
- while (-1 != (i = Parrot_str_find_index(INTERP, s, orig, i))) {
+ while (-1 != (i = STRING_index(INTERP, s, orig, i))) {
s = Parrot_str_replace(INTERP, s, i, old_len, _new);
i += new_len;
}
@@ -714,6 +714,28 @@
/*
+=item C<void reverse(STRING *src)>
+
+Either reverse this PMC's contents or set this PMC's value to the reverse of C<src>,
+if present.
+
+=cut
+
+*/
+
+ METHOD reverse(STRING *src :optional, INTVAL got_src :opt_flag) {
+ STRING *s;
+ if (got_src) {
+ SET_ATTR_str_val(INTERP, SELF, Parrot_str_reverse(INTERP, src));
+ }
+ else {
+ GET_ATTR_str_val(INTERP, SELF, s);
+ SET_ATTR_str_val(INTERP, SELF, Parrot_str_reverse(INTERP, s));
+ }
+ }
+
+/*
+
=item C<INTEGER is_integer(STRING *src)>
Checks if the ascii STRING C<str> is just an integer.
Modified: branches/html_cleanup/src/pmc/stringbuilder.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/stringbuilder.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/stringbuilder.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -320,7 +320,7 @@
/* We must clone here becase we can reallocate buffer behind the scene... */
/* TODO Optimize it to avoid creation of redundant STRING */
return Parrot_str_clone(INTERP,
- Parrot_str_substr(INTERP, buffer, offset, length));
+ STRING_substr(INTERP, buffer, offset, length));
}
/*
@@ -360,7 +360,7 @@
* for the string builder. */
while (pos >= 0) {
/* Find the next % */
- percentPos = Parrot_str_find_index(INTERP, fmt, percent, pos);
+ percentPos = STRING_index(INTERP, fmt, percent, pos);
if (percentPos < 0) {
if (pos == 0) {
@@ -369,7 +369,7 @@
else {
/* remaining string can be added as is. */
VTABLE_push_string(INTERP, stringbuilder,
- Parrot_str_substr(INTERP, fmt, pos,
+ STRING_substr(INTERP, fmt, pos,
Parrot_str_length(INTERP, fmt) -pos));
}
break;
@@ -377,13 +377,13 @@
else {
/* slurp up to just before the % sign... */
VTABLE_push_string(INTERP, stringbuilder,
- Parrot_str_substr(INTERP, fmt, pos, percentPos - pos));
+ STRING_substr(INTERP, fmt, pos, percentPos - pos));
/* skip the % sign */
pos = percentPos + 1 ;
}
/* key is always a single character */
- key = Parrot_str_substr(INTERP, fmt, pos++, 1);
+ key = STRING_substr(INTERP, fmt, pos++, 1);
if (VTABLE_exists_keyed_str(INTERP, hash, key)) {
VTABLE_push_string(INTERP, stringbuilder,
@@ -394,7 +394,7 @@
VTABLE_get_string_keyed_int(INTERP, args,
Parrot_str_to_int(INTERP, key)));
}
- else if (Parrot_str_equal(INTERP, key, comma)) {
+ else if (STRING_equal(INTERP, key, comma)) {
INTVAL num_args = VTABLE_elements(INTERP, args);
INTVAL pos_args;
@@ -405,13 +405,13 @@
VTABLE_get_string_keyed_int(INTERP, args, pos_args));
}
}
- else if (Parrot_str_equal(INTERP, key, percent)) {
+ else if (STRING_equal(INTERP, key, percent)) {
VTABLE_push_string(INTERP, stringbuilder, percent);
}
else {
/* %foo has no special meaning, pass it through unchanged */
VTABLE_push_string(INTERP, stringbuilder,
- Parrot_str_substr(INTERP, fmt, pos-2, 2));
+ STRING_substr(INTERP, fmt, pos-2, 2));
}
}
Modified: branches/html_cleanup/src/pmc/stringhandle.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/stringhandle.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/stringhandle.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -55,7 +55,7 @@
if (STRING_IS_NULL(s))
return 0;
else
- return Parrot_str_equal(interp, s, CONST_STRING(interp, "utf8"));
+ return STRING_equal(interp, s, CONST_STRING(interp, "utf8"));
}
pmclass StringHandle extends Handle auto_attrs {
@@ -391,15 +391,15 @@
GET_ATTR_flags(INTERP, SELF, flags);
if (got_type) {
- if (Parrot_str_equal(INTERP, new_type, nobuffer_string)) {
+ if (STRING_equal(INTERP, new_type, nobuffer_string)) {
flags &= ~ PIO_F_LINEBUF;
flags &= ~ PIO_F_BLKBUF;
}
- else if (Parrot_str_equal(INTERP, new_type, linebuffer_string)) {
+ else if (STRING_equal(INTERP, new_type, linebuffer_string)) {
flags |= PIO_F_LINEBUF;
flags &= ~ PIO_F_BLKBUF;
}
- else if (Parrot_str_equal(INTERP, new_type, fullbuffer_string)) {
+ else if (STRING_equal(INTERP, new_type, fullbuffer_string)) {
flags &= ~ PIO_F_LINEBUF;
flags |= PIO_F_BLKBUF;
}
Modified: branches/html_cleanup/src/pmc/sub.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/sub.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/sub.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -908,22 +908,22 @@
}
/* Return the requested argument information */
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "pos_required"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "pos_required"))) {
count_found = (INTVAL)sub->arg_info->pos_required;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "pos_optional"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "pos_optional"))) {
count_found = (INTVAL)sub->arg_info->pos_optional;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "pos_slurpy"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "pos_slurpy"))) {
count_found = (INTVAL)sub->arg_info->pos_slurpy;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "named_required"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "named_required"))) {
count_found = (INTVAL)sub->arg_info->named_required;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "named_optional"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "named_optional"))) {
count_found = (INTVAL)sub->arg_info->named_optional;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "named_slurpy"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "named_slurpy"))) {
count_found = (INTVAL)sub->arg_info->named_slurpy;
}
else
@@ -1040,7 +1040,7 @@
EXCEPTION_INVALID_OPERATION,
"illegal register kind '%Ss'", reg);
- kind = Parrot_str_find_index(INTERP, types, reg, 0);
+ kind = STRING_index(INTERP, types, reg, 0);
if (kind == -1)
Parrot_ex_throw_from_c_args(INTERP, NULL,
Modified: branches/html_cleanup/src/pmc/task.pmc
==============================================================================
--- branches/html_cleanup/src/pmc/task.pmc Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/pmc/task.pmc Sun Oct 24 12:14:32 2010 (r49645)
@@ -209,27 +209,27 @@
Parrot_Task_attributes * const core_struct = PARROT_TASK(SELF);
PMC *value;
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
value = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
core_struct->id);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
value = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, value, core_struct->type);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
value = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, value, core_struct->subtype);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
value = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
core_struct->priority);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
value = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, value, core_struct->status);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
value = Parrot_pmc_new(INTERP, enum_class_Float);
VTABLE_set_number_native(INTERP, value, core_struct->birthtime);
}
@@ -252,28 +252,28 @@
VTABLE void set_attr_str(STRING *name, PMC *value) {
Parrot_Task_attributes * const core_struct = PARROT_TASK(SELF);
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
core_struct->id = VTABLE_get_integer(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
core_struct->type = VTABLE_get_string(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
core_struct->subtype = VTABLE_get_string(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
core_struct->priority = VTABLE_get_integer(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
core_struct->status = VTABLE_get_string(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
core_struct->birthtime = VTABLE_get_number(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
core_struct->codeblock = value;
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "data"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "data"))) {
core_struct->data = value;
}
}
Modified: branches/html_cleanup/src/runcore/main.c
==============================================================================
--- branches/html_cleanup/src/runcore/main.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/runcore/main.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -127,11 +127,11 @@
size_t i;
if (interp->run_core
- && Parrot_str_equal(interp, name, interp->run_core->name))
+ && STRING_equal(interp, name, interp->run_core->name))
return;
for (i = 0; i < num_cores; ++i) {
- if (Parrot_str_equal(interp, name, interp->cores[i]->name)) {
+ if (STRING_equal(interp, name, interp->cores[i]->name)) {
interp->run_core = interp->cores[i];
return;
}
Modified: branches/html_cleanup/src/runcore/profiling.c
==============================================================================
--- branches/html_cleanup/src/runcore/profiling.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/runcore/profiling.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2009, Parrot Foundation.
+Copyright (C) 2009-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -34,7 +34,6 @@
#endif
#define PPROF_VERSION 2
-#define MAX_NS_DEPTH 32
#define code_start interp->code->base.data
#define code_end (interp->code->base.data + interp->code->base.size)
@@ -44,9 +43,32 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static void add_bogus_parent_runloop(
- ARGIN(Parrot_profiling_runcore_t * runcore))
- __attribute__nonnull__(1);
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static char* get_filename_cstr(PARROT_INTERP,
+ ARGIN(Parrot_profiling_runcore_t *runcore),
+ ARGIN(PMC* ctx_pmc),
+ ARGIN(opcode_t *pc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4);
+
+static INTVAL get_line_num_from_cache(PARROT_INTERP,
+ ARGIN(Parrot_profiling_runcore_t *runcore),
+ ARGIN(PMC *ctx_pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static char* get_ns_cstr(PARROT_INTERP,
+ ARGIN(Parrot_profiling_runcore_t *runcore),
+ ARGIN(PMC* ctx_pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
PARROT_CAN_RETURN_NULL
static void * init_profiling_core(PARROT_INTERP,
@@ -56,6 +78,41 @@
__attribute__nonnull__(2)
__attribute__nonnull__(3);
+static void record_annotations(PARROT_INTERP,
+ ARGIN(Parrot_profiling_runcore_t *runcore),
+ ARGIN(PPROF_DATA *pprof_data),
+ ARGIN(opcode_t *pc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4);
+
+static void record_bogus_parent_runloop(
+ ARGIN(Parrot_profiling_runcore_t * runcore))
+ __attribute__nonnull__(1);
+
+static void record_ctx_info(PARROT_INTERP,
+ ARGIN(Parrot_profiling_runcore_t *runcore),
+ ARGIN(PPROF_DATA *pprof_data),
+ ARGIN(PMC* ctx_pmc),
+ ARGIN(opcode_t *pc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4)
+ __attribute__nonnull__(5);
+
+static void record_op(PARROT_INTERP,
+ ARGIN(Parrot_profiling_runcore_t *runcore),
+ ARGIN(PPROF_DATA *pprof_data),
+ ARGIN(const char *op_name),
+ INTVAL op_time,
+ INTVAL line_num)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4);
+
static void record_values_ascii_pprof(
ARGIN(Parrot_profiling_runcore_t * runcore),
ARGIN(PPROF_DATA *pprof_data),
@@ -70,6 +127,13 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+static void record_version_and_cli(PARROT_INTERP,
+ ARGIN(Parrot_profiling_runcore_t *runcore),
+ ARGIN(PPROF_DATA* pprof_data))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static opcode_t * runops_profiling_core(PARROT_INTERP,
@@ -79,22 +143,63 @@
__attribute__nonnull__(2)
__attribute__nonnull__(3);
-#define ASSERT_ARGS_add_bogus_parent_runloop __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(runcore))
+static void store_postop_time(PARROT_INTERP,
+ ARGIN(Parrot_profiling_runcore_t *runcore))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+#define ASSERT_ARGS_get_filename_cstr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(runcore) \
+ , PARROT_ASSERT_ARG(ctx_pmc) \
+ , PARROT_ASSERT_ARG(pc))
+#define ASSERT_ARGS_get_line_num_from_cache __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(runcore) \
+ , PARROT_ASSERT_ARG(ctx_pmc))
+#define ASSERT_ARGS_get_ns_cstr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(runcore) \
+ , PARROT_ASSERT_ARG(ctx_pmc))
#define ASSERT_ARGS_init_profiling_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(runcore) \
, PARROT_ASSERT_ARG(pc))
+#define ASSERT_ARGS_record_annotations __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(runcore) \
+ , PARROT_ASSERT_ARG(pprof_data) \
+ , PARROT_ASSERT_ARG(pc))
+#define ASSERT_ARGS_record_bogus_parent_runloop __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(runcore))
+#define ASSERT_ARGS_record_ctx_info __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(runcore) \
+ , PARROT_ASSERT_ARG(pprof_data) \
+ , PARROT_ASSERT_ARG(ctx_pmc) \
+ , PARROT_ASSERT_ARG(pc))
+#define ASSERT_ARGS_record_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(runcore) \
+ , PARROT_ASSERT_ARG(pprof_data) \
+ , PARROT_ASSERT_ARG(op_name))
#define ASSERT_ARGS_record_values_ascii_pprof __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(runcore) \
, PARROT_ASSERT_ARG(pprof_data))
#define ASSERT_ARGS_record_values_none __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(runcore) \
, PARROT_ASSERT_ARG(pprof_data))
+#define ASSERT_ARGS_record_version_and_cli __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(runcore) \
+ , PARROT_ASSERT_ARG(pprof_data))
#define ASSERT_ARGS_runops_profiling_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(runcore) \
, PARROT_ASSERT_ARG(pc))
+#define ASSERT_ARGS_store_postop_time __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(runcore))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -103,7 +208,7 @@
=item C<void Parrot_runcore_profiling_init(PARROT_INTERP)>
-Registers the profiling runcore with Parrot.
+Register the profiling runcore with Parrot.
=cut
@@ -148,7 +253,7 @@
{
ASSERT_ARGS(init_profiling_core)
- char *profile_filename, *output_cstr, *filename_cstr;
+ char *profile_filename_cstr, *output_cstr, *env_filename_cstr;
/* initialize the runcore struct */
runcore->runops = (Parrot_runcore_runops_fn_t) runops_profiling_core;
@@ -157,7 +262,6 @@
runcore->prev_ctx = NULL;
runcore->profiling_flags = 0;
runcore->runloop_count = 0;
- runcore->level = 0;
runcore->time_size = 32;
runcore->line_cache = parrot_new_pointer_hash(interp);
runcore->time = mem_gc_allocate_n_typed(interp, runcore->time_size,
@@ -169,10 +273,10 @@
if (output_cstr) {
STRING *profile_format_str = Parrot_str_new(interp, output_cstr, 0);
- if (Parrot_str_equal(interp, profile_format_str, CONST_STRING(interp, "pprof"))) {
+ if (STRING_equal(interp, profile_format_str, CONST_STRING(interp, "pprof"))) {
runcore->output_fn = record_values_ascii_pprof;
}
- else if (Parrot_str_equal(interp, profile_format_str, CONST_STRING(interp, "none"))) {
+ else if (STRING_equal(interp, profile_format_str, CONST_STRING(interp, "none"))) {
runcore->output_fn = record_values_none;
}
else {
@@ -186,41 +290,41 @@
}
/* figure out where to write the output */
- filename_cstr = Parrot_getenv(interp, CONST_STRING(interp, "PARROT_PROFILING_FILENAME"));
+ env_filename_cstr = Parrot_getenv(interp, CONST_STRING(interp, "PARROT_PROFILING_FILENAME"));
if (runcore->output_fn != record_values_none) {
- if (filename_cstr) {
+ if (env_filename_cstr) {
STRING *lc_filename;
- runcore->profile_filename = Parrot_str_new(interp, filename_cstr, 0);
+ runcore->profile_filename = Parrot_str_new(interp, env_filename_cstr, 0);
/* this is a little goofy, but it means that we unconditionally free
* profile_filename later in this function */
- profile_filename = Parrot_str_to_cstring(interp, runcore->profile_filename);
+ profile_filename_cstr = Parrot_str_to_cstring(interp, runcore->profile_filename);
lc_filename = Parrot_str_downcase(interp, runcore->profile_filename);
- if (Parrot_str_equal(interp, lc_filename, CONST_STRING(interp, "stderr"))) {
+ if (STRING_equal(interp, lc_filename, CONST_STRING(interp, "stderr"))) {
runcore->profile_fd = stderr;
runcore->profile_filename = lc_filename;
}
- else if (Parrot_str_equal(interp, lc_filename, CONST_STRING(interp, "stdout"))) {
+ else if (STRING_equal(interp, lc_filename, CONST_STRING(interp, "stdout"))) {
runcore->profile_fd = stdout;
runcore->profile_filename = lc_filename;
}
else
- runcore->profile_fd = fopen(profile_filename, "w");
+ runcore->profile_fd = fopen(profile_filename_cstr, "w");
}
else {
runcore->profile_filename = Parrot_sprintf_c(interp, "parrot.pprof.%d", getpid());
- profile_filename = Parrot_str_to_cstring(interp, runcore->profile_filename);
- runcore->profile_fd = fopen(profile_filename, "w");
+ profile_filename_cstr = Parrot_str_to_cstring(interp, runcore->profile_filename);
+ runcore->profile_fd = fopen(profile_filename_cstr, "w");
}
if (!runcore->profile_fd) {
- fprintf(stderr, "unable to open %s for writing", profile_filename);
- Parrot_str_free_cstring(profile_filename);
+ fprintf(stderr, "unable to open %s for writing", profile_filename_cstr);
+ Parrot_str_free_cstring(profile_filename_cstr);
exit(1);
}
- Parrot_str_free_cstring(profile_filename);
+ Parrot_str_free_cstring(profile_filename_cstr);
}
else {
runcore->profile_filename = CONST_STRING(interp, "none");
@@ -236,7 +340,7 @@
}
/* put profile_filename in the gc root set so it won't get collected */
- Parrot_pmc_gc_register(interp, (PMC *) runcore->profile_filename);
+ Parrot_str_gc_register(interp, runcore->profile_filename);
Profiling_first_loop_SET(runcore);
@@ -250,7 +354,28 @@
Parrot_profiling_runcore_t *runcore, opcode_t *pc)>
Runs the Parrot operations starting at C<pc> until there are no more
-operations, with tracing, bounds checking, and profiling enabled.
+operations with tracing, bounds checking and profiling enabled.
+
+Some ops, such as those which call VTABLE functions, spawn inner (a.k.a.
+"inferior" or "nested") runloops. To properly calculate the time used by these
+ops, it's necessary to keep track of start and end of both the current op and
+the current runloop. The time spent by an op which spawns an inner runloop
+is calculated as the time between the start of the op and the start of the
+inner runloop (between A and B below), plus the time between the end of the
+inner runloop and the end of the op (between C and D below). The AB tracking
+is handled after DO_OP(), using the exit_check flag to ensure that the value is
+only calculated when leaving an inner runloop. The CD tracking is handled by
+C<store_postop_time>.
+
+ ___________outer runloop_______________
+/op op with inner runloop op \
+---- ---------------------------- ----
+| | | __inner runloop__ | | |
+---- - / op op \ - ----
+ ---- ----
+ ^ ^ | | | | ^ ^
+ | | ---- ---- | |
+ A B C D
=cut
@@ -266,35 +391,287 @@
PMC *argv;
opcode_t *preop_pc;
+ const char *preop_opname;
UHUGEINTVAL op_time;
PPROF_DATA pprof_data[PPROF_DATA_MAX + 1];
runcore->runcore_start = Parrot_hires_get_time();
- /* if we're in a nested runloop, */
- if (runcore->level != 0) {
+ /* if we're in a inner runloop, */
+ if (interp->current_runloop_level != 1)
+ store_postop_time(interp, runcore);
+
+ record_version_and_cli(interp, runcore, (PPROF_DATA *)&pprof_data);
- if (runcore->level >= runcore->time_size) {
- runcore->time_size *= 2;
- runcore->time = mem_gc_realloc_n_typed(interp,
- runcore->time, runcore->time_size + 1, UHUGEINTVAL);
+ while (pc) {
+ Parrot_Context *preop_ctx;
+ INTVAL preop_line_num;
+ PMC *preop_ctx_pmc;
+
+ if (pc < code_start || pc >= code_end)
+ Parrot_ex_throw_from_c_args(interp, NULL, 1,
+ "attempt to access code outside of current code segment");
+
+ preop_ctx_pmc = CURRENT_CONTEXT(interp);
+ preop_ctx = PMC_data_typed(preop_ctx_pmc, Parrot_Context*);
+ preop_ctx->current_pc = pc;
+ preop_pc = pc;
+ preop_opname = interp->code->op_info_table[*pc]->name;
+ preop_line_num = get_line_num_from_cache(interp, runcore, preop_ctx_pmc);
+
+ Profiling_exit_check_CLEAR(runcore);
+
+ runcore->op_start = Parrot_hires_get_time();
+ DO_OP(pc, interp);
+ runcore->op_finish = Parrot_hires_get_time();
+
+ if (Profiling_exit_check_TEST(runcore)) {
+ op_time = runcore->op_finish - runcore->runcore_finish;
+ op_time += runcore->time[interp->current_runloop_level-1];
+ runcore->time[interp->current_runloop_level-1] = 0;
}
+ else
+ op_time = runcore->op_finish - runcore->op_start;
+
+ /* Occasionally the ctx stays the same while the sub changes, e.g.
+ * with a call to a subclass' method. */
+ if ((runcore->prev_ctx != preop_ctx) || runcore->prev_sub != preop_ctx->current_sub)
+ record_ctx_info(interp, runcore, (PPROF_DATA *) &pprof_data, preop_ctx_pmc, preop_pc);
+
+ if (Profiling_report_annotations_TEST(runcore) && interp->code->annotations)
+ record_annotations(interp, runcore, (PPROF_DATA *) &pprof_data, pc);
- /* store the time between DO_OP and the start of this runcore in this
- * op's running total */
- runcore->time[runcore->level] =
- runcore->runcore_start - runcore->op_start;
+ record_op(interp, runcore, (PPROF_DATA *) &pprof_data,
+ preop_opname, op_time, preop_line_num);
}
- argv = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_ARGV_LIST);
+ /* make it easy to tell separate runloops apart */
+ if (interp->current_runloop_level == 1) {
+ runcore->output_fn(runcore, pprof_data, PPROF_LINE_END_OF_RUNLOOP);
+ record_bogus_parent_runloop(runcore);
+ }
- /* argv isn't initialized until after :init (etc) subs are executed */
- if (argv && !Profiling_have_printed_cli_TEST(runcore)) {
+ Profiling_exit_check_SET(runcore);
+ runcore->runcore_finish = Parrot_hires_get_time();
+ return pc;
+}
+
+/*
+
+=item C<static void record_ctx_info(PARROT_INTERP, Parrot_profiling_runcore_t
+*runcore, PPROF_DATA *pprof_data, PMC* ctx_pmc, opcode_t *pc)>
+
+If the active context has changed, record information about the new context.
+
+=cut
+
+*/
+
+static void
+record_ctx_info(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore),
+ARGIN(PPROF_DATA *pprof_data), ARGIN(PMC* ctx_pmc), ARGIN(opcode_t *pc))
+{
+ ASSERT_ARGS(record_ctx_info)
+
+ Parrot_Context *ctx = PMC_data_typed(ctx_pmc, Parrot_Context *);
+
+ if (ctx->current_sub) {
+ char *filename_cstr, *ns_cstr;
+
+ filename_cstr = get_filename_cstr(interp, runcore, ctx_pmc, pc);
+ ns_cstr = get_ns_cstr(interp, runcore, ctx_pmc);
+
+ pprof_data[PPROF_DATA_NAMESPACE] = (PPROF_DATA) ns_cstr;
+ pprof_data[PPROF_DATA_FILENAME] = (PPROF_DATA) filename_cstr;
+
+ if (Profiling_canonical_output_TEST(runcore)) {
+ pprof_data[PPROF_DATA_SUB_ADDR] = (PPROF_DATA) 0x3;
+ pprof_data[PPROF_DATA_CTX_ADDR] = (PPROF_DATA) 0x3;
+ }
+ else {
+ pprof_data[PPROF_DATA_SUB_ADDR] = (PPROF_DATA) ctx->current_sub;
+ pprof_data[PPROF_DATA_CTX_ADDR] = (PPROF_DATA) ctx;
+ }
+
+ runcore->output_fn(runcore, pprof_data, PPROF_LINE_CONTEXT_SWITCH);
+
+ Parrot_str_free_cstring(ns_cstr);
+ Parrot_str_free_cstring(filename_cstr);
+ }
+
+ runcore->prev_ctx = ctx;
+ runcore->prev_sub = ctx->current_sub;
+
+}
+
+/*
+
+=item C<static INTVAL get_line_num_from_cache(PARROT_INTERP,
+Parrot_profiling_runcore_t *runcore, PMC *ctx_pmc)>
+
+Return the line number for the current context, either by fetching from cache
+or by calculating.
+
+=cut
+
+*/
+
+static INTVAL
+get_line_num_from_cache(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore),
+ARGIN(PMC *ctx_pmc))
+{
+
+ ASSERT_ARGS(get_line_num_from_cache)
+
+ Parrot_Context *ctx = PMC_data_typed(ctx_pmc, Parrot_Context *);
- char *cli_cstr;
- STRING *space, *cli_args, *cli_exe, *cli_str;
- PMC *exe_name = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_EXECUTABLE);
+ INTVAL line_num = hash_value_to_int(interp, runcore->line_cache,
+ parrot_hash_get(interp, runcore->line_cache, ctx->current_pc));
+ /* Parrot_Sub_get_line_from_pc eats up about 20-30% of execution time
+ * *with* this cache in place. */
+ if (line_num == 0) {
+ line_num = Parrot_Sub_get_line_from_pc(interp,
+ Parrot_pcc_get_sub(interp, ctx_pmc), ctx->current_pc);
+ parrot_hash_put(interp, runcore->line_cache, ctx->current_pc, (void *) line_num);
+ }
+ return line_num;
+}
+
+/*
+
+=item C<static void record_annotations(PARROT_INTERP, Parrot_profiling_runcore_t
+*runcore, PPROF_DATA *pprof_data, opcode_t *pc)>
+
+Record annotation data for the current pc, if any exist.
+
+=cut
+
+*/
+
+static void
+record_annotations(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore),
+ARGIN(PPROF_DATA *pprof_data), ARGIN(opcode_t *pc))
+{
+
+ ASSERT_ARGS(record_annotations)
+
+ PMC * const annot = PackFile_Annotations_lookup(interp,
+ interp->code->annotations, pc - code_start + 1, NULL);
+
+ if (!PMC_IS_NULL(annot)) {
+
+ PMC *iter = VTABLE_get_iter(interp, annot);
+ while (VTABLE_get_bool(interp, iter)) {
+
+ STRING *key = VTABLE_shift_string(interp, iter);
+ STRING *val = VTABLE_get_string_keyed_str(interp, annot, key);
+ char *key_cstr = Parrot_str_to_cstring(interp, key);
+ char *val_cstr = Parrot_str_to_cstring(interp, val);
+
+ pprof_data[PPROF_DATA_ANNOTATION_NAME] = (PPROF_DATA) key_cstr;
+ pprof_data[PPROF_DATA_ANNOTATION_VALUE] = (PPROF_DATA) val_cstr;
+ runcore->output_fn(runcore, pprof_data, PPROF_LINE_ANNOTATION);
+
+ Parrot_str_free_cstring(key_cstr);
+ Parrot_str_free_cstring(val_cstr);
+ }
+ }
+}
+
+/*
+
+=item C<static void record_op(PARROT_INTERP, Parrot_profiling_runcore_t
+*runcore, PPROF_DATA *pprof_data, const char *op_name, INTVAL op_time, INTVAL
+line_num)>
+
+Record profiing information about the most recently-executed op.
+
+=cut
+
+*/
+
+static void
+record_op(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore),
+ARGIN(PPROF_DATA *pprof_data), ARGIN(const char *op_name), INTVAL op_time,
+INTVAL line_num)
+{
+
+ ASSERT_ARGS(record_op)
+
+ if (Profiling_canonical_output_TEST(runcore))
+ pprof_data[PPROF_DATA_TIME] = 1;
+ else
+ pprof_data[PPROF_DATA_TIME] = op_time;
+
+ pprof_data[PPROF_DATA_LINE] = line_num;
+ pprof_data[PPROF_DATA_OPNAME] = (PPROF_DATA) op_name;
+ runcore->output_fn(runcore, pprof_data, PPROF_LINE_OP);
+}
+
+
+
+
+/*
+
+=item C<static void store_postop_time(PARROT_INTERP, Parrot_profiling_runcore_t
+*runcore)>
+
+Record the time spend between the end of an inner runloop and the end of an
+outer op.
+
+=cut
+
+*/
+
+static void
+store_postop_time(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore))
+{
+
+ ASSERT_ARGS(store_postop_time)
+
+ if (interp->current_runloop_level-1 >= runcore->time_size) {
+ runcore->time_size *= 2;
+ runcore->time = mem_gc_realloc_n_typed(interp,
+ runcore->time, runcore->time_size + 1, UHUGEINTVAL);
+ }
+
+ runcore->time[interp->current_runloop_level-1] = runcore->runcore_start - runcore->op_start;
+}
+
+/*
+
+=item C<static void record_version_and_cli(PARROT_INTERP,
+Parrot_profiling_runcore_t *runcore, PPROF_DATA* pprof_data)>
+
+Record information about CLI arguments passed to the program being profiled and
+the version of the output file format.
+
+Note that because of the way the parrot executable parses its options,
+arguments passed directly to C<parrot> (such as C<--gc ms2> or C<--hash-seed
+234>) will not appear here.
+
+=cut
+
+*/
+
+static void
+record_version_and_cli(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore),
+ ARGIN(PPROF_DATA* pprof_data))
+{
+
+ ASSERT_ARGS(record_version_and_cli)
+
+ char *cli_cstr;
+ STRING *space, *cli_args, *cli_exe, *cli_str;
+ PMC *exe_name;
+ PMC *argv = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_ARGV_LIST);
+
+ /* argv isn't initialized until after :init (etc) subs are executed */
+ if (!PMC_IS_NULL(argv) && !Profiling_have_printed_cli_TEST(runcore)) {
+
+ Profiling_have_printed_cli_SET(runcore);
+ exe_name = VTABLE_get_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_EXECUTABLE);
space = CONST_STRING(interp, " ");
cli_args = Parrot_str_join(interp, space, argv);
cli_exe = VTABLE_get_string(interp, exe_name);
@@ -306,179 +683,98 @@
runcore->output_fn(runcore, pprof_data, PPROF_LINE_CLI);
Parrot_str_free_cstring(cli_cstr);
-
- Profiling_have_printed_cli_SET(runcore);
}
if (Profiling_first_loop_TEST(runcore)) {
-
Profiling_first_loop_CLEAR(runcore);
-
pprof_data[PPROF_DATA_VERSION] = (PPROF_DATA) PPROF_VERSION;
runcore->output_fn(runcore, pprof_data, PPROF_LINE_VERSION);
-
- add_bogus_parent_runloop(runcore);
+ record_bogus_parent_runloop(runcore);
}
- while (pc) {
- Parrot_Context *preop_ctx;
- INTVAL preop_line;
- PMC *preop_ctx_pmc;
+}
- if (pc < code_start || pc >= code_end)
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "attempt to access code outside of current code segment");
+/*
- preop_ctx_pmc = CURRENT_CONTEXT(interp);
- preop_ctx = PMC_data_typed(preop_ctx_pmc, Parrot_Context*);
- preop_ctx->current_pc = pc;
- preop_pc = pc;
+=item C<static char* get_ns_cstr(PARROT_INTERP, Parrot_profiling_runcore_t
+*runcore, PMC* ctx_pmc)>
- ++runcore->level;
- Profiling_exit_check_CLEAR(runcore);
+Return a C string containing a human-readable representation of the namespace
+for C<ctx_pmc>.
- runcore->op_start = Parrot_hires_get_time();
- DO_OP(pc, interp);
- runcore->op_finish = Parrot_hires_get_time();
+=cut
- if (Profiling_exit_check_TEST(runcore)) {
- op_time = runcore->op_finish - runcore->runcore_finish;
- op_time += runcore->time[runcore->level];
- runcore->time[runcore->level] = 0;
- }
- else
- op_time = runcore->op_finish - runcore->op_start;
+*/
- --runcore->level;
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static char*
+get_ns_cstr(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore),
+ARGIN(PMC* ctx_pmc))
+{
- /* if current context changed since the last printing of a CS line... */
- /* Occasionally the ctx stays the same while the sub changes, possible
- * with a call to a subclass' method. */
+ ASSERT_ARGS(get_ns_cstr)
- if ((runcore->prev_ctx != preop_ctx)
- || runcore->prev_sub != preop_ctx->current_sub) {
+ STRING *sub_name, *full_ns, *ns_separator, *tmp;
+ char *full_ns_cstr;
+ Parrot_Context *ctx = PMC_data_typed(ctx_pmc, Parrot_Context *);
+ PMC *ns = ctx->current_namespace;
- if (preop_ctx->current_sub) {
- STRING *sub_name, *full_ns, *ns_separator, *preop_filename;
- char *full_ns_cstr, *filename_cstr;
- STRING *ns_names[MAX_NS_DEPTH];
- PMC *ns = preop_ctx->current_namespace;
- INTVAL i;
-
- preop_filename = Parrot_Sub_get_filename_from_pc(interp,
- Parrot_pcc_get_sub(interp, preop_ctx_pmc), pc);
-
- filename_cstr = Parrot_str_to_cstring(interp, preop_filename);
-
- /* build the namespace string */
- full_ns = Parrot_str_new(interp, "", 0);
- ns_separator = Parrot_str_new(interp, ";", 1);
-
- i = MAX_NS_DEPTH - 1;
- for (;ns ; --i) {
- if (i < 0) {
- /* should probably warn about truncated namespace here */
- break;
- }
- GETATTR_NameSpace_name(interp, ns, ns_names[i]);
- GETATTR_NameSpace_parent(interp, ns, ns);
- }
-
- i += 2; /* the root namespace has an empty name, so ignore it */
- for (;i < MAX_NS_DEPTH; ++i) {
- full_ns = Parrot_str_concat(interp, full_ns, ns_names[i]);
- full_ns = Parrot_str_concat(interp, full_ns, ns_separator);
- }
-
- GETATTR_Sub_name(interp, preop_ctx->current_sub, sub_name);
- full_ns = Parrot_str_concat(interp, full_ns, sub_name);
- full_ns_cstr = Parrot_str_to_cstring(interp, full_ns);
-
- pprof_data[PPROF_DATA_NAMESPACE] = (PPROF_DATA) full_ns_cstr;
- pprof_data[PPROF_DATA_FILENAME] = (PPROF_DATA) filename_cstr;
-
- if (Profiling_canonical_output_TEST(runcore)) {
- pprof_data[PPROF_DATA_SUB_ADDR] = (PPROF_DATA) 0x3;
- pprof_data[PPROF_DATA_CTX_ADDR] = (PPROF_DATA) 0x3;
- }
- else {
- pprof_data[PPROF_DATA_SUB_ADDR] = (PPROF_DATA) preop_ctx->current_sub;
- pprof_data[PPROF_DATA_CTX_ADDR] = (PPROF_DATA) preop_ctx;
- }
+ full_ns = Parrot_str_new(interp, "", 0);
+ ns_separator = Parrot_str_new(interp, ";", 1);
- runcore->output_fn(runcore, pprof_data, PPROF_LINE_CONTEXT_SWITCH);
+ while (1) {
+ GETATTR_NameSpace_name(interp, ns, tmp);
- Parrot_str_free_cstring(full_ns_cstr);
- Parrot_str_free_cstring(filename_cstr);
- }
+ /* The root ns has the empty string as its name, so ignore it. */
+ if (Parrot_str_length(interp, tmp) == 0)
+ break;
- runcore->prev_ctx = preop_ctx;
- runcore->prev_sub = preop_ctx->current_sub;
- }
+ full_ns = Parrot_str_concat(interp, ns_separator, full_ns);
+ full_ns = Parrot_str_concat(interp, tmp, full_ns);
- preop_line = hash_value_to_int(interp, runcore->line_cache,
- parrot_hash_get(interp, runcore->line_cache,
- preop_ctx->current_pc));
-
- if (preop_line == 0) {
- preop_line = Parrot_Sub_get_line_from_pc(interp,
- Parrot_pcc_get_sub(interp, preop_ctx_pmc),
- preop_ctx->current_pc);
- parrot_hash_put(interp, runcore->line_cache, preop_ctx->current_pc,
- (void *) preop_line);
- }
+ GETATTR_NameSpace_parent(interp, ns, ns);
+ }
- if (Profiling_report_annotations_TEST(runcore) && interp->code->annotations) {
- PMC * const annot = PackFile_Annotations_lookup(interp,
- interp->code->annotations, pc - code_start + 1, NULL);
-
- if (!PMC_IS_NULL(annot)) {
-
- PMC *iter = VTABLE_get_iter(interp, annot);
- while (VTABLE_get_bool(interp, iter)) {
-
- STRING *key = VTABLE_shift_string(interp, iter);
- STRING *val = VTABLE_get_string_keyed_str(interp, annot, key);
- char *key_cstr = Parrot_str_to_cstring(interp, key);
- char *val_cstr = Parrot_str_to_cstring(interp, val);
-
- pprof_data[PPROF_DATA_ANNOTATION_NAME] = (PPROF_DATA) key_cstr;
- pprof_data[PPROF_DATA_ANNOTATION_VALUE] = (PPROF_DATA) val_cstr;
- runcore->output_fn(runcore, pprof_data, PPROF_LINE_ANNOTATION);
-
- Parrot_str_free_cstring(key_cstr);
- Parrot_str_free_cstring(val_cstr);
- }
- }
- }
+ GETATTR_Sub_name(interp, ctx->current_sub, sub_name);
+ full_ns = Parrot_str_concat(interp, full_ns, sub_name);
+ return Parrot_str_to_cstring(interp, full_ns);
- if (Profiling_canonical_output_TEST(runcore)) {
- pprof_data[PPROF_DATA_TIME] = 1;
- }
- else {
- pprof_data[PPROF_DATA_TIME] = op_time;
- }
- pprof_data[PPROF_DATA_LINE] = preop_line;
- pprof_data[PPROF_DATA_OPNAME] = (PPROF_DATA)(interp->code->op_info_table)[*preop_pc]->name;
- runcore->output_fn(runcore, pprof_data, PPROF_LINE_OP);
- }
+}
- /* make it easy to tell separate runloops apart */
- if (runcore->level == 0) {
- runcore->output_fn(runcore, pprof_data, PPROF_LINE_END_OF_RUNLOOP);
+/*
- add_bogus_parent_runloop(runcore);
- }
+=item C<static char* get_filename_cstr(PARROT_INTERP, Parrot_profiling_runcore_t
+*runcore, PMC* ctx_pmc, opcode_t *pc)>
- Profiling_exit_check_SET(runcore);
- runcore->runcore_finish = Parrot_hires_get_time();
- return pc;
+Return the filename for C<ctx_pmc> as a C string.
+
+=cut
+
+*/
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static char*
+get_filename_cstr(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore),
+ARGIN(PMC* ctx_pmc), ARGIN(opcode_t *pc))
+{
+
+ ASSERT_ARGS(get_filename_cstr)
+
+ STRING *filename = Parrot_Sub_get_filename_from_pc(interp,
+ Parrot_pcc_get_sub(interp, ctx_pmc), pc);
+ char *filename_cstr = Parrot_str_to_cstring(interp, filename);
+
+ return filename_cstr;
}
+
+
/*
-=item C<static void add_bogus_parent_runloop(Parrot_profiling_runcore_t *
+=item C<static void record_bogus_parent_runloop(Parrot_profiling_runcore_t *
runcore)>
Record profiling information for a bogus parent runloop. Parrot program
@@ -492,9 +788,9 @@
*/
static void
-add_bogus_parent_runloop(ARGIN(Parrot_profiling_runcore_t * runcore))
+record_bogus_parent_runloop(ARGIN(Parrot_profiling_runcore_t * runcore))
{
- ASSERT_ARGS(add_bogus_parent_runloop)
+ ASSERT_ARGS(record_bogus_parent_runloop)
PPROF_DATA pprof_data[PPROF_DATA_MAX+1];
Modified: branches/html_cleanup/src/runcore/trace.c
==============================================================================
--- branches/html_cleanup/src/runcore/trace.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/runcore/trace.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -28,6 +28,7 @@
#include "parrot/context.h"
#include "pmc/pmc_sub.h"
#include "pmc/pmc_callcontext.h"
+#include "parrot/oplib/core_ops.h"
/* HEADERIZER HFILE: include/parrot/runcore_trace.h */
@@ -298,6 +299,7 @@
ASSERT_ARGS(trace_op_dump)
Interp * const debugger = debugger_or_interp(interp);
op_info_t * const info = interp->code->op_info_table[*pc];
+ op_lib_t * core_ops = PARROT_GET_CORE_OPLIB(interp);
PMC *sig = PMCNULL;
INTVAL n = info->op_count;
INTVAL s = 1;
@@ -309,10 +311,10 @@
#define ARGS_COLUMN 40
- if (*pc == PARROT_OP_set_args_pc
- || *pc == PARROT_OP_get_results_pc
- || *pc == PARROT_OP_get_params_pc
- || *pc == PARROT_OP_set_returns_pc) {
+ if (OPCODE_IS(interp, interp->code, *pc, core_ops, PARROT_OP_set_args_pc)
+ || OPCODE_IS(interp, interp->code, *pc, core_ops, PARROT_OP_get_results_pc)
+ || OPCODE_IS(interp, interp->code, *pc, core_ops, PARROT_OP_get_params_pc)
+ || OPCODE_IS(interp, interp->code, *pc, core_ops, PARROT_OP_set_returns_pc)) {
sig = interp->code->const_table->pmc.constants[pc[1]];
if (!sig)
@@ -333,7 +335,7 @@
if (i < info->op_count)
type = info->types[i - 1];
else {
- if (!sig)
+ if (PMC_IS_NULL(sig))
Parrot_ex_throw_from_c_args(interp, NULL, 1,
"NULL sig PMC detected in trace_op_dump");
Modified: branches/html_cleanup/src/scheduler.c
==============================================================================
--- branches/html_cleanup/src/scheduler.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/scheduler.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -137,13 +137,13 @@
PMC * const type_pmc = VTABLE_get_attr_str(interp, task, CONST_STRING(interp, "type"));
STRING * const type = VTABLE_get_string(interp, type_pmc);
- if (Parrot_str_equal(interp, type, CONST_STRING(interp, "callback"))) {
+ if (STRING_equal(interp, type, CONST_STRING(interp, "callback"))) {
Parrot_cx_invoke_callback(interp, task);
}
- else if (Parrot_str_equal(interp, type, CONST_STRING(interp, "timer"))) {
+ else if (STRING_equal(interp, type, CONST_STRING(interp, "timer"))) {
Parrot_cx_timer_invoke(interp, task);
}
- else if (Parrot_str_equal(interp, type, CONST_STRING(interp, "event"))) {
+ else if (STRING_equal(interp, type, CONST_STRING(interp, "event"))) {
PMC * const handler = Parrot_cx_find_handler_for_task(interp, task);
if (!PMC_IS_NULL(handler)) {
PMC * const handler_sub = VTABLE_get_attr_str(interp, handler, CONST_STRING(interp, "code"));
@@ -455,7 +455,7 @@
for (index = 0; index < num_tasks; ++index) {
PMC *message = VTABLE_get_pmc_keyed_int(interp, sched_struct->messages, index);
if (!PMC_IS_NULL(message)
- && Parrot_str_equal(interp, VTABLE_get_string(interp, message),
+ && STRING_equal(interp, VTABLE_get_string(interp, message),
suspend_str)) {
VTABLE_delete_keyed_int(interp, sched_struct->messages, index);
UNLOCK(sched_struct->msg_lock);
@@ -533,9 +533,9 @@
typedef enum { Hunknown, Hexception, Hevent } Htype;
const Htype htype =
- Parrot_str_equal(interp, handler_type, exception_str) ?
+ STRING_equal(interp, handler_type, exception_str) ?
Hexception :
- Parrot_str_equal(interp, handler_type, event_str) ?
+ STRING_equal(interp, handler_type, event_str) ?
Hevent :
Hunknown;
STRING * const handler_name = (htype == Hexception) ? handler_str : (STRING *)NULL;
@@ -606,9 +606,9 @@
typedef enum { Hunknown, Hexception, Hevent } Htype;
const Htype htype =
- (Parrot_str_equal(interp, handler_type, exception_str)) ?
+ (STRING_equal(interp, handler_type, exception_str)) ?
Hexception :
- (Parrot_str_equal(interp, handler_type, event_str)) ?
+ (STRING_equal(interp, handler_type, event_str)) ?
Hevent :
Hunknown;
STRING * const handler_name = (htype == Hexception) ? handler_str : (STRING *)NULL;
@@ -1009,26 +1009,29 @@
Parrot_cx_schedule_sleep(PARROT_INTERP, FLOATVAL time, ARGIN_NULLOK(opcode_t *next))
{
ASSERT_ARGS(Parrot_cx_schedule_sleep)
-#ifdef PARROT_HAS_THREADS
- Parrot_cond condition;
- Parrot_mutex lock;
- const FLOATVAL timer_end = time + Parrot_floatval_time();
- struct timespec time_struct;
/* Tell the scheduler runloop to wake, this is a good time to process
* pending tasks. */
Parrot_cx_runloop_wake(interp, interp->scheduler);
- /* Tell this thread to sleep for the requested time. */
- COND_INIT(condition);
- MUTEX_INIT(lock);
- LOCK(lock);
- time_struct.tv_sec = (time_t) timer_end;
- time_struct.tv_nsec = (long)((timer_end - time_struct.tv_sec)*1000.0f) *1000L*1000L;
- COND_TIMED_WAIT(condition, lock, &time_struct);
- UNLOCK(lock);
- COND_DESTROY(condition);
- MUTEX_DESTROY(lock);
+#ifdef PARROT_HAS_THREADS
+ {
+ Parrot_cond condition;
+ Parrot_mutex lock;
+ const FLOATVAL timer_end = time + Parrot_floatval_time();
+ struct timespec time_struct;
+
+ /* Tell this thread to sleep for the requested time. */
+ COND_INIT(condition);
+ MUTEX_INIT(lock);
+ LOCK(lock);
+ time_struct.tv_sec = (time_t) timer_end;
+ time_struct.tv_nsec = (long)((timer_end - time_struct.tv_sec)*1000.0f) *1000L*1000L;
+ COND_TIMED_WAIT(condition, lock, &time_struct);
+ UNLOCK(lock);
+ COND_DESTROY(condition);
+ MUTEX_DESTROY(lock);
+ }
#else
/* A more primitive, platform-specific, non-threaded form of sleep. */
if (time > 1000) {
@@ -1132,7 +1135,7 @@
#endif
UNLOCK(sched_struct->msg_lock);
if (!PMC_IS_NULL(message)
- && Parrot_str_equal(interp, VTABLE_get_string(interp, message),
+ && STRING_equal(interp, VTABLE_get_string(interp, message),
suspend_str)) {
#if CX_DEBUG
fprintf(stderr, "found a suspend, suspending [interp=%p]\n", interp);
Modified: branches/html_cleanup/src/spf_render.c
==============================================================================
--- branches/html_cleanup/src/spf_render.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/spf_render.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -147,12 +147,12 @@
if (is_int_type) {
if (info->flags & FLAG_PREC && info->prec == 0 &&
len == 1 &&
- string_ord(interp, str, 0) == '0') {
+ STRING_ord(interp, str, 0) == '0') {
str = Parrot_str_chopn(interp, str, len);
len = 0;
}
/* +, space */
- if (!len || string_ord(interp, str, 0) != '-') {
+ if (!len || STRING_ord(interp, str, 0) != '-') {
if (info->flags & FLAG_PLUS) {
STRING * const cs = CONST_STRING(interp, "+");
str = Parrot_str_concat(interp, cs, str);
@@ -197,11 +197,11 @@
else { /* right-align */
/* signed and zero padded */
if (info->flags & FLAG_ZERO
- && (string_ord(interp, str, 0) == '-' ||
- string_ord(interp, str, 0) == '+')) {
+ && (STRING_ord(interp, str, 0) == '-' ||
+ STRING_ord(interp, str, 0) == '+')) {
STRING *temp = NULL;
STRING *ignored;
- temp = Parrot_str_substr(interp, str, 1, len-1);
+ temp = STRING_substr(interp, str, 1, len-1);
str = Parrot_str_chopn(interp, str, -1);
str = Parrot_str_concat(interp, str, fill);
str = Parrot_str_concat(interp, str, temp);
@@ -429,15 +429,15 @@
char tc[PARROT_SPRINTF_BUFFER_SIZE];
for (i = 0; i < pat_len; ++i) {
- if (string_ord(interp, pat, i) == '%') { /* % */
+ if (STRING_ord(interp, pat, i) == '%') { /* % */
if (len) {
- substr = Parrot_str_substr(interp, pat, old, len);
+ substr = STRING_substr(interp, pat, old, len);
/* XXX This shouldn't modify targ the pointer */
targ = Parrot_str_concat(interp, targ, substr);
}
len = 0;
old = i;
- if (string_ord(interp, pat, i + 1) == '%') {
+ if (STRING_ord(interp, pat, i + 1) == '%') {
/* skip this one, make next the first char
* of literal sequence, starting at old */
++i;
@@ -548,7 +548,7 @@
*/
for (++i; i < pat_len && info.phase != PHASE_DONE; ++i) {
- const INTVAL ch = string_ord(interp, pat, i);
+ const INTVAL ch = STRING_ord(interp, pat, i);
switch (info.phase) {
/*@fallthrough@ */ case PHASE_FLAGS:
@@ -685,7 +685,7 @@
/* INTEGERS */
case 'c':
{
- STRING * const ts = string_chr(interp,
+ STRING * const ts = Parrot_str_chr(interp,
(UINTVAL)obj->getint(interp, info.type, obj));
targ = str_concat_w_flags(interp, targ, &info, ts, NULL);
}
@@ -941,7 +941,7 @@
}
}
if (len) {
- substr = Parrot_str_substr(interp, pat, old, len);
+ substr = STRING_substr(interp, pat, old, len);
targ = Parrot_str_concat(interp, targ, substr);
}
Modified: branches/html_cleanup/src/spf_vtable.c
==============================================================================
--- branches/html_cleanup/src/spf_vtable.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/spf_vtable.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -452,7 +452,7 @@
++obj->index;
s = VTABLE_get_string(interp, tmp);
- return Parrot_str_substr(interp, s, 0, 1);
+ return STRING_substr(interp, s, 0, 1);
}
/*
Modified: branches/html_cleanup/src/string/api.c
==============================================================================
--- branches/html_cleanup/src/string/api.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/api.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -44,6 +44,13 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+PARROT_WARN_UNUSED_RESULT
+PARROT_PURE_FUNCTION
+static INTVAL string_max_bytes(SHIM_INTERP,
+ ARGIN(const STRING *s),
+ UINTVAL nchars)
+ __attribute__nonnull__(2);
+
PARROT_INLINE
PARROT_IGNORABLE_RESULT
PARROT_CAN_RETURN_NULL
@@ -58,6 +65,8 @@
static void throw_illegal_escape(PARROT_INTERP)
__attribute__nonnull__(1);
+#define ASSERT_ARGS_string_max_bytes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_string_rep_compatible __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(a) \
, PARROT_ASSERT_ARG(b))
@@ -145,7 +154,7 @@
#if PARROT_CATCH_NULL
/* initialize STRINGNULL, but not in the constant table */
STRINGNULL = Parrot_str_new_init(interp, NULL, 0,
- Parrot_default_encoding_ptr,
+ Parrot_null_encoding_ptr,
PObj_constant_FLAG);
#endif
@@ -245,43 +254,48 @@
{
ASSERT_ARGS(string_rep_compatible)
- if (a->encoding == b->encoding) {
+ PARROT_ASSERT(a->encoding && b->encoding);
+
+ if (a->encoding == b->encoding)
return a->encoding;
- }
/* a table could possibly simplify the logic */
- if (a->encoding == Parrot_utf8_encoding_ptr
- && b->encoding == Parrot_ascii_encoding_ptr) {
- if (a->strlen == a->bufused) {
+
+ if (STRING_max_bytes_per_codepoint(a) == 1
+ && STRING_max_bytes_per_codepoint(b) == 1) {
+ /* Return the "largest" encoding where ascii < latin1 < binary */
+
+ if (b->encoding == Parrot_ascii_encoding_ptr)
+ return a->encoding;
+ if (a->encoding == Parrot_ascii_encoding_ptr)
+ return b->encoding;
+ if (a->encoding == Parrot_binary_encoding_ptr)
+ return a->encoding;
+ if (b->encoding == Parrot_binary_encoding_ptr)
return b->encoding;
- }
- return a->encoding;
}
-
- if (b->encoding == Parrot_utf8_encoding_ptr
- && a->encoding == Parrot_ascii_encoding_ptr) {
- if (b->strlen == b->bufused) {
+ else {
+ /* UTF-8 strings are ASCII compatible if their byte length equals
+ their codepoint length. This is a nice trick but it can cause many
+ surprises when UTF-8 strings are suddenly "downgraded" to ASCII
+ strings. */
+
+ if (a->encoding == Parrot_utf8_encoding_ptr
+ && b->encoding == Parrot_ascii_encoding_ptr) {
+ if (a->strlen == a->bufused) {
+ return b->encoding;
+ }
return a->encoding;
}
- return b->encoding;
- }
- /* Sanity check before dereferencing the encoding pointers */
- if (a->encoding == NULL || b->encoding == NULL)
- return NULL;
-
- if (STRING_max_bytes_per_codepoint(a) != 1 ||
- STRING_max_bytes_per_codepoint(b) != 1)
- return NULL;
-
- if (b->encoding == Parrot_ascii_encoding_ptr)
- return a->encoding;
- if (a->encoding == Parrot_ascii_encoding_ptr)
- return b->encoding;
- if (a->encoding == Parrot_binary_encoding_ptr)
- return a->encoding;
- if (b->encoding == Parrot_binary_encoding_ptr)
- return b->encoding;
+ if (b->encoding == Parrot_utf8_encoding_ptr
+ && a->encoding == Parrot_ascii_encoding_ptr) {
+ if (b->strlen == b->bufused) {
+ return a->encoding;
+ }
+ return b->encoding;
+ }
+ }
return NULL;
}
@@ -329,9 +343,14 @@
Parrot_str_clone(PARROT_INTERP, ARGIN(const STRING *s))
{
ASSERT_ARGS(Parrot_str_clone)
+ size_t alloc_size;
+ STRING *result;
+
+ if (STRING_IS_NULL(s))
+ return STRINGNULL;
- const size_t alloc_size = s->bufused;
- STRING * const result = Parrot_gc_new_string_header(interp, 0);
+ result = Parrot_gc_new_string_header(interp, 0);
+ alloc_size = s->bufused;
if (alloc_size) {
/* Allocate new chunk of memory */
@@ -368,7 +387,10 @@
{
ASSERT_ARGS(Parrot_str_copy)
STRING *d;
- const int is_movable = PObj_is_movable_TESTALL(s);
+ int is_movable;
+
+ if (STRING_IS_NULL(s))
+ return STRINGNULL;
d = Parrot_gc_new_string_header(interp,
PObj_get_FLAGS(s) & ~PObj_constant_FLAG);
@@ -382,6 +404,8 @@
/* Set the string copy flag */
PObj_is_string_copy_SET(d);
+ is_movable = PObj_is_movable_TESTALL(s);
+
/* Now check that buffer allocated from pool and affected by compacting */
if (is_movable && Buffer_bufstart(s)) {
/* If so, mark it as shared */
@@ -420,14 +444,17 @@
STRING *dest;
UINTVAL total_length;
- if (STRING_IS_NULL(a)) {
- if (STRING_IS_NULL(b))
- return STRINGNULL;
+ if (STRING_IS_NULL(a) && STRING_IS_NULL(b))
+ return STRINGNULL;
+
+ if (STRING_length(a) == 0) {
+ if (STRING_length(b) == 0)
+ return CONST_STRING(interp, "");
else
return Parrot_str_copy(interp, b);
}
else {
- if (STRING_IS_NULL(b))
+ if (STRING_length(b) == 0)
return Parrot_str_copy(interp, a);
}
@@ -556,7 +583,7 @@
result->strstart = (char *)Buffer_bufstart(result);
result->bufused = len;
result->strlen = len;
- result->encoding = Parrot_binary_encoding_ptr;
+ result->encoding = Parrot_binary_encoding_ptr;
Buffer_buflen(buffer) = 0;
Buffer_bufstart(buffer) = NULL;
@@ -658,7 +685,8 @@
len, const STR_VTABLE *encoding, UINTVAL flags)>
Given a buffer, its length, an encoding, a character set, and STRING flags,
-creates and returns a new string. Don't call this directly.
+creates and returns a new string. If buffer is NULL and len >= 0, allocates
+len bytes.
=cut
@@ -743,14 +771,13 @@
/*
-=item C<INTVAL Parrot_str_indexed(PARROT_INTERP, const STRING *s, UINTVAL idx)>
+=item C<INTVAL Parrot_str_indexed(PARROT_INTERP, const STRING *s, INTVAL idx)>
-Returns the character (or glyph, depending upon the string's encoding). This
-abstracts the process of finding the Nth character in a (possibly Unicode or
-JIS-encoded) string, the idea being that once the encoding functions are
-fleshed out, this function can do the right thing.
+Returns the codepoint at a given index into a string. Negative indexes are
+treated as counting from the end of the string. Throws an exception if C<s>
+is null or C<idx> is out of bounds.
-Note that this is not range-checked.
+Identical to the STRING_ord macro.
=cut
@@ -759,22 +786,29 @@
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL
-Parrot_str_indexed(PARROT_INTERP, ARGIN(const STRING *s), UINTVAL idx)
+Parrot_str_indexed(PARROT_INTERP, ARGIN(const STRING *s), INTVAL idx)
{
ASSERT_ARGS(Parrot_str_indexed)
- ASSERT_STRING_SANITY(s);
- return (INTVAL)STRING_ord(interp, s, idx);
+
+ if (s == NULL)
+ s = STRINGNULL;
+
+ return STRING_ord(interp, s, idx);
}
/*
-=item C<INTVAL Parrot_str_find_index(PARROT_INTERP, const STRING *s, const
-STRING *s2, INTVAL start)>
+=item C<INTVAL Parrot_str_find_index(PARROT_INTERP, const STRING *src, const
+STRING *search, INTVAL start)>
Returns the character position of the second Parrot string in the first at or
after C<start>. The return value is a (0 based) offset in characters, not
-bytes. If second string is not found in the first string, returns -1.
+bytes. If the search string is not found in the first string or it is null or
+empty, returns -1. If C<start> is out of bounds, returns -1. Throws an
+exception if C<src> is null.
+
+Identical to the STRING_index macro.
=cut
@@ -783,36 +817,15 @@
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL
-Parrot_str_find_index(PARROT_INTERP, ARGIN(const STRING *s),
- ARGIN(const STRING *s2), INTVAL start)
+Parrot_str_find_index(PARROT_INTERP, ARGIN(const STRING *src),
+ ARGIN(const STRING *search), INTVAL start)
{
ASSERT_ARGS(Parrot_str_find_index)
- UINTVAL len;
-
- if (start < 0)
- return -1;
-
- len = Parrot_str_length(interp, s);
- if (!len)
- return -1;
-
- if (start >= (INTVAL)len)
- return -1;
+ if (src == NULL)
+ src = STRINGNULL;
- /* Short circuit when s is the same as s2 */
- if (s == s2)
- return start == 0 ? 0 : -1;
-
- if (!Parrot_str_length(interp, s2))
- return -1;
- else {
- DECL_CONST_CAST;
- STRING *src = PARROT_const_cast(STRING *, s);
- STRING *search = PARROT_const_cast(STRING *, s2);
-
- return STRING_index(interp, src, search, (UINTVAL)start);
- }
+ return STRING_index(interp, src, search, start);
}
@@ -833,38 +846,17 @@
string_ord(PARROT_INTERP, ARGIN(const STRING *s), INTVAL idx)
{
ASSERT_ARGS(string_ord)
- UINTVAL len;
- UINTVAL true_index = (UINTVAL)idx;
- if (STRING_IS_NULL(s))
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ORD_OUT_OF_STRING,
- "Cannot get character of NULL string");
-
- len = Parrot_str_length(interp, s);
- if (len == 0)
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ORD_OUT_OF_STRING,
- "Cannot get character of empty string");
-
- if (idx < 0) {
- if ((INTVAL)(idx + len) < 0)
- Parrot_ex_throw_from_c_args(interp, NULL,
- EXCEPTION_ORD_OUT_OF_STRING,
- "Cannot get character before beginning of string");
-
- true_index = (UINTVAL)(len + idx);
- }
+ if (s == NULL)
+ s = STRINGNULL;
- if (true_index > (len - 1))
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ORD_OUT_OF_STRING,
- "Cannot get character past end of string");
-
- return Parrot_str_indexed(interp, s, true_index);
+ return STRING_ord(interp, s, idx);
}
/*
-=item C<STRING * string_chr(PARROT_INTERP, UINTVAL character)>
+=item C<STRING * Parrot_str_chr(PARROT_INTERP, UINTVAL character)>
Returns a single-character Parrot string.
@@ -876,9 +868,9 @@
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
STRING *
-string_chr(PARROT_INTERP, UINTVAL character)
+Parrot_str_chr(PARROT_INTERP, UINTVAL character)
{
- ASSERT_ARGS(string_chr)
+ ASSERT_ARGS(Parrot_str_chr)
if (character > 0xff)
return Parrot_utf8_encoding_ptr->chr(interp, character);
@@ -891,6 +883,29 @@
/*
+=item C<STRING * string_chr(PARROT_INTERP, UINTVAL character)>
+
+Returns a single-character Parrot string.
+
+Deprecated, use Parrot_str_chr instead.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
+STRING *
+string_chr(PARROT_INTERP, UINTVAL character)
+{
+ ASSERT_ARGS(string_chr)
+ return Parrot_str_chr(interp, character);
+}
+
+
+/*
+
=back
=head2 Vtable Dispatch Functions
@@ -919,7 +934,8 @@
/*
-=item C<INTVAL string_max_bytes(PARROT_INTERP, const STRING *s, UINTVAL nchars)>
+=item C<static INTVAL string_max_bytes(PARROT_INTERP, const STRING *s, UINTVAL
+nchars)>
Returns the number of bytes required to safely contain the specified number
of characters in the specified Parrot string's representation.
@@ -928,10 +944,9 @@
*/
-PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_PURE_FUNCTION
-INTVAL
+static INTVAL
string_max_bytes(SHIM_INTERP, ARGIN(const STRING *s), UINTVAL nchars)
{
ASSERT_ARGS(string_max_bytes)
@@ -984,7 +999,12 @@
offset, INTVAL length)>
Returns substring of length C<length> from C<offset> from the specified
-Parrot string.
+Parrot string. If C<offset> is negative, it counts from the end of the
+string. Returns the empty string if C<offset> equals the length of the
+string. Throws an exception if C<src> is null or C<offset> is out of bounds.
+Truncates C<length> if it extends beyond the end of the string.
+
+Identical to the STRING_substr macro.
=cut
@@ -999,38 +1019,10 @@
{
ASSERT_ARGS(Parrot_str_substr)
- UINTVAL true_length;
- UINTVAL true_offset = (UINTVAL)offset;
- const UINTVAL src_length = Parrot_str_length(interp, src);
-
- if (STRING_IS_NULL(src))
- Parrot_ex_throw_from_c_args(interp, NULL,
- EXCEPTION_SUBSTR_OUT_OF_STRING, "Cannot substr on a null string");
-
- ASSERT_STRING_SANITY(src);
+ if (src == NULL)
+ src = STRINGNULL;
- /* Allow regexes to return $' easily for "aaa" =~ /aaa/ */
- if (true_offset == src_length || length < 1)
- return CONST_STRING(interp, "");
-
- if (offset < 0)
- true_offset = src_length + offset;
-
- /* 0 based... */
- if (src_length == 0 || true_offset > src_length - 1)
- Parrot_ex_throw_from_c_args(interp, NULL,
- EXCEPTION_SUBSTR_OUT_OF_STRING,
- "Cannot take substr outside string");
-
- true_length = (UINTVAL)length;
-
- if (true_length > (src_length - true_offset))
- true_length = (UINTVAL)(src_length - true_offset);
-
- if (true_length == src_length && !offset)
- return (STRING *)src;
- else
- return STRING_substr(interp, src, true_offset, true_length);
+ return STRING_substr(interp, src, offset, length);
}
/*
@@ -1044,7 +1036,6 @@
*/
-PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
STRING *
@@ -1086,7 +1077,6 @@
*/
-PARROT_EXPORT
INTVAL
Parrot_str_iter_index(PARROT_INTERP,
ARGIN(const STRING *src),
@@ -1195,17 +1185,22 @@
if (true_length > (src->strlen - true_offset))
true_length = (UINTVAL)(src->strlen - true_offset);
- /* may have different reps..... */
- enc = string_rep_compatible(interp, src, rep);
-
- if (!enc) {
- if (src->encoding != Parrot_utf8_encoding_ptr)
- src = Parrot_utf8_encoding_ptr->to_encoding(interp, src);
- if (rep->encoding != Parrot_utf8_encoding_ptr)
- rep = Parrot_utf8_encoding_ptr->to_encoding(interp, rep);
- /* Remember selected encoding */
+ if (STRING_IS_NULL(rep)) {
enc = src->encoding;
}
+ else {
+ /* may have different reps..... */
+ enc = string_rep_compatible(interp, src, rep);
+
+ if (!enc) {
+ if (src->encoding != Parrot_utf8_encoding_ptr)
+ src = Parrot_utf8_encoding_ptr->to_encoding(interp, src);
+ if (rep->encoding != Parrot_utf8_encoding_ptr)
+ rep = Parrot_utf8_encoding_ptr->to_encoding(interp, rep);
+ /* Remember selected encoding */
+ enc = src->encoding;
+ }
+ }
/* get byte position of the part that will be replaced */
STRING_ITER_INIT(interp, &iter);
@@ -1277,47 +1272,12 @@
Parrot_str_chopn(PARROT_INTERP, ARGIN(const STRING *s), INTVAL n)
{
ASSERT_ARGS(Parrot_str_chopn)
+ INTVAL end = -n;
- STRING * const chopped = Parrot_str_copy(interp, s);
- UINTVAL new_length;
-
- if (n < 0) {
- new_length = -n;
- if (new_length > chopped->strlen)
- return chopped;
- }
- else {
- if (chopped->strlen > (UINTVAL)n)
- new_length = chopped->strlen - n;
- else
- new_length = 0;
- }
-
- chopped->hashval = 0;
-
- if (!new_length || !chopped->strlen) {
- chopped->bufused = chopped->strlen = 0;
- return chopped;
- }
-
- if (STRING_max_bytes_per_codepoint(chopped) == 1) {
- chopped->bufused = new_length;
- }
- else if (chopped->encoding == Parrot_ucs2_encoding_ptr) {
- const UINTVAL uchar_size = chopped->bufused / chopped->strlen;
- chopped->bufused = new_length * uchar_size;
- }
- else {
- String_iter iter;
-
- STRING_ITER_INIT(interp, &iter);
- STRING_iter_set_position(interp, s, &iter, new_length);
- chopped->bufused = iter.bytepos;
- }
+ if (n >= 0)
+ end += STRING_length(s);
- chopped->strlen = new_length;
-
- return chopped;
+ return STRING_substr(interp, s, 0, end);
}
@@ -1329,7 +1289,9 @@
Compares two strings to each other. If s1 is less than s2, returns -1. If the
strings are equal, returns 0. If s1 is greater than s2, returns 2. This
comparison uses the character set collation order of the strings for
-comparison.
+comparison. The null string is considered equal to the empty string.
+
+Identical to the STRING_compare macro.
=cut
@@ -1341,14 +1303,9 @@
Parrot_str_compare(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK(const STRING *s2))
{
ASSERT_ARGS(Parrot_str_compare)
- if (STRING_IS_NULL(s2))
- return s1 && (s1->strlen != 0);
-
- if (STRING_IS_NULL(s1))
- return -(s2->strlen != 0);
- ASSERT_STRING_SANITY(s1);
- ASSERT_STRING_SANITY(s2);
+ if (s1 == NULL)
+ s1 = STRINGNULL;
return STRING_compare(interp, s1, s2);
}
@@ -1372,7 +1329,11 @@
Parrot_str_not_equal(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK(const STRING *s2))
{
ASSERT_ARGS(Parrot_str_not_equal)
- return !Parrot_str_equal(interp, s1, s2);
+
+ if (s1 == NULL)
+ s1 = STRINGNULL;
+
+ return !STRING_equal(interp, s1, s2);
}
@@ -1382,10 +1343,12 @@
*s2)>
Compares two Parrot strings, performing type and encoding conversions if
-necessary.
+necessary. The null string is considered equal to the empty string.
Returns 1 if the strings are equal, and 0 otherwise.
+Identical to the STRING_equal macro.
+
=cut
*/
@@ -1397,33 +1360,10 @@
{
ASSERT_ARGS(Parrot_str_equal)
- if ((s1 == s2) || (STRING_IS_NULL(s1) && STRING_IS_NULL(s2)))
- return 1;
- else if (STRING_IS_NULL(s2))
- return s1->strlen == 0;
- else if (STRING_IS_NULL(s1))
- return s2->strlen == 0;
+ if (s1 == NULL)
+ s1 = STRINGNULL;
- /* we don't care which is bigger */
- else if (s1->strlen != s2->strlen)
- return 0;
- else if ((s1->hashval != s2->hashval) && s1->hashval && s2->hashval)
- return 0;
-
- /* s2->strlen is the same here */
- else if (s1->strlen == 0)
- return 1;
-
- /* COWed strings */
- else if ((s1->strstart == s2->strstart) && (s1->bufused == s2->bufused))
- return 1;
-
- /*
- * now,
- * both strings are non-null
- * both strings have same length
- */
- return STRING_compare(interp, s1, s2) == 0;
+ return STRING_equal(interp, s1, s2);
}
@@ -1785,13 +1725,13 @@
Parrot_str_boolean(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
{
ASSERT_ARGS(Parrot_str_boolean)
- const INTVAL len = !STRING_IS_NULL(s) ? Parrot_str_length(interp, s) : 0;
+ const INTVAL len = STRING_length(s);
if (len == 0)
return 0;
if (len == 1) {
- const UINTVAL c = Parrot_str_indexed(interp, s, 0);
+ const UINTVAL c = STRING_ord(interp, s, 0);
/* relying on character literals being interpreted as ASCII--may
not be correct on EBCDIC systems. use numeric value instead? */
@@ -2073,13 +2013,13 @@
/* charpos <= 2 because for "-i" iter already advanced to next char */
if (check_nan && (iter.charpos <= 2)) {
STRING *t = Parrot_str_upcase(interp, s);
- if (Parrot_str_equal(interp, t, CONST_STRING(interp, "NAN")))
+ if (STRING_equal(interp, t, CONST_STRING(interp, "NAN")))
return PARROT_FLOATVAL_NAN_QUIET;
- else if (Parrot_str_equal(interp, t, CONST_STRING(interp, "INF"))
- || Parrot_str_equal(interp, t, CONST_STRING(interp, "INFINITY")))
+ else if (STRING_equal(interp, t, CONST_STRING(interp, "INF"))
+ || STRING_equal(interp, t, CONST_STRING(interp, "INFINITY")))
return PARROT_FLOATVAL_INF_POSITIVE;
- else if (Parrot_str_equal(interp, t, CONST_STRING(interp, "-INF"))
- || Parrot_str_equal(interp, t, CONST_STRING(interp, "-INFINITY")))
+ else if (STRING_equal(interp, t, CONST_STRING(interp, "-INF"))
+ || STRING_equal(interp, t, CONST_STRING(interp, "-INFINITY")))
return PARROT_FLOATVAL_INF_NEGATIVE;
}
@@ -2314,11 +2254,13 @@
/*
-=item C<size_t Parrot_str_to_hashval(PARROT_INTERP, STRING *s)>
+=item C<size_t Parrot_str_to_hashval(PARROT_INTERP, const STRING *s)>
Returns the hash value for the specified Parrot string, caching it in
C<< s->hashval >>.
+Identical to the STRING_hash macro.
+
=cut
*/
@@ -2326,23 +2268,47 @@
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
size_t
-Parrot_str_to_hashval(PARROT_INTERP, ARGMOD_NULLOK(STRING *s))
+Parrot_str_to_hashval(PARROT_INTERP, ARGIN(const STRING *s))
{
ASSERT_ARGS(Parrot_str_to_hashval)
- size_t hashval = interp->hash_seed;
+ if (s == NULL)
+ s = STRINGNULL;
- if (!STRING_IS_NULL(s)) {
- if (s->strlen)
- hashval = STRING_hash(interp, s, hashval);
+ return STRING_hash(interp, s, interp->hash_seed);
+}
+
+/*
+
+=item C<STRING * Parrot_str_reverse(PARROT_INTERP, const STRING *src)>
+
+Return the reverse of C<src>, even for non-ascii strings.
+
+=cut
- s->hashval = hashval;
+*/
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+STRING *
+Parrot_str_reverse(PARROT_INTERP, ARGIN(const STRING *src))
+{
+ ASSERT_ARGS(Parrot_str_reverse)
+ String_iter iter;
+ INTVAL pos;
+ PMC *sb;
+
+ STRING_ITER_INIT(interp, &iter);
+ sb = Parrot_pmc_new(interp, enum_class_StringBuilder);
+
+ for (pos = STRING_length(src) - 1; pos >= 0; pos--) {
+ VTABLE_push_string(interp, sb, Parrot_str_chr(interp,
+ STRING_iter_get(interp, src, &iter, pos)));
}
- return hashval;
+ return VTABLE_get_string(interp, sb);
}
-
/*
=item C<STRING * Parrot_str_escape(PARROT_INTERP, const STRING *src)>
@@ -2879,43 +2845,6 @@
/*
-=item C<STRING * string_increment(PARROT_INTERP, const STRING *s)>
-
-Increments the string in the Perl 5 fashion, where incrementing aa gives you bb
-and so on. Currently single char only.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-STRING *
-string_increment(PARROT_INTERP, ARGIN(const STRING *s))
-{
- ASSERT_ARGS(string_increment)
- UINTVAL o;
-
- if (Parrot_str_length(interp, s) != 1)
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
- "increment only for length = 1 done");
-
- o = (UINTVAL)string_ord(interp, s, 0);
-
- if ((o >= 'A' && o < 'Z') || (o >= 'a' && o < 'z')) {
- ++o;
- /* TODO increment in place */
- return string_chr(interp, o);
- }
-
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
- "increment out of range - unimplemented");
-}
-
-
-/*
-
=item C<const char * Parrot_str_cstring(PARROT_INTERP, const STRING *str)>
Returns a C string from a Parrot string. Both sides are treated
@@ -3314,6 +3243,54 @@
return Parrot_str_from_uint(interp, tc, (UHUGEINTVAL)num, base, is_neg);
}
+/*
+
+=back
+
+=head2 GC registry interface
+
+=over 4
+
+=item C<void Parrot_str_gc_register(PARROT_INTERP, STRING *s)>
+
+Registers the STRING from the interpreter's GC registry to prevent it from
+being collected.
+
+*/
+
+
+PARROT_EXPORT
+void
+Parrot_str_gc_register(PARROT_INTERP, ARGIN(STRING *s))
+{
+ ASSERT_ARGS(Parrot_str_gc_register)
+ /* Better not trigger a GC run with a potentially unanchored PMC */
+ Parrot_block_GC_mark(interp);
+
+ PARROT_ASSERT(interp->gc_registry);
+
+ VTABLE_set_pmc_keyed_str(interp, interp->gc_registry, s, PMCNULL);
+ Parrot_unblock_GC_mark(interp);
+}
+
+/*
+
+=item C<void Parrot_str_gc_unregister(PARROT_INTERP, STRING *s)>
+
+Unregisters the STRING from the interpreter's GC registry.
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_str_gc_unregister(PARROT_INTERP, ARGIN(STRING *s))
+{
+ ASSERT_ARGS(Parrot_str_gc_unregister)
+ PARROT_ASSERT(interp->gc_registry);
+
+ VTABLE_delete_keyed_str(interp, interp->gc_registry, s);
+}
+
/*
Modified: branches/html_cleanup/src/string/encoding.c
==============================================================================
--- branches/html_cleanup/src/string/encoding.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -163,18 +163,18 @@
int i;
for (i = 0; i < n; ++i) {
- if (Parrot_str_equal(interp, encodings[i]->name_str, encodingname))
+ if (STRING_equal(interp, encodings[i]->name_str, encodingname))
return i;
}
/* backwards compatibility */
- if (Parrot_str_equal(interp, encodingname, unicode_str)) {
+ if (STRING_equal(interp, encodingname, unicode_str)) {
for (i = 0; i < n; ++i) {
if (STREQ(encodings[i]->name, "utf8"))
return i;
}
}
- else if (Parrot_str_equal(interp, encodingname, fixed_8_str)) {
+ else if (STRING_equal(interp, encodingname, fixed_8_str)) {
for (i = 0; i < n; ++i) {
if (STREQ(encodings[i]->name, "ascii"))
return i;
Modified: branches/html_cleanup/src/string/encoding/ascii.c
==============================================================================
--- branches/html_cleanup/src/string/encoding/ascii.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding/ascii.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -518,7 +518,7 @@
fixed8_scan,
fixed8_ord,
- fixed8_substr,
+ fixed_substr,
ascii_is_cclass,
ascii_find_cclass,
Modified: branches/html_cleanup/src/string/encoding/binary.c
==============================================================================
--- branches/html_cleanup/src/string/encoding/binary.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding/binary.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -240,7 +240,7 @@
fixed8_scan,
fixed8_ord,
- fixed8_substr,
+ fixed_substr,
binary_is_cclass,
binary_find_cclass,
Modified: branches/html_cleanup/src/string/encoding/latin1.c
==============================================================================
--- branches/html_cleanup/src/string/encoding/latin1.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding/latin1.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -545,7 +545,7 @@
fixed8_scan,
fixed8_ord,
- fixed8_substr,
+ fixed_substr,
latin1_is_cclass,
latin1_find_cclass,
Copied: branches/html_cleanup/src/string/encoding/null.c (from r49644, trunk/src/string/encoding/null.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/src/string/encoding/null.c Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/src/string/encoding/null.c)
@@ -0,0 +1,254 @@
+/*
+Copyright (C) 2010, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/string/encoding/null.c
+
+=head1 DESCRIPTION
+
+This file implements encoding functions for the null string.
+
+=over 4
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+
+/* HEADERIZER HFILE: none */
+
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_WARN_UNUSED_RESULT
+static INTVAL null_compare(PARROT_INTERP,
+ ARGIN(const STRING *lhs),
+ ARGIN(const STRING *rhs))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_WARN_UNUSED_RESULT
+static INTVAL null_equal(PARROT_INTERP,
+ ARGIN(const STRING *lhs),
+ ARGIN(const STRING *rhs))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+static void null_error(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+PARROT_WARN_UNUSED_RESULT
+static size_t null_hash(SHIM_INTERP, ARGIN(const STRING *s), size_t hashval)
+ __attribute__nonnull__(2);
+
+PARROT_WARN_UNUSED_RESULT
+static UINTVAL null_scan(PARROT_INTERP, ARGIN(const STRING *src))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_WARN_UNUSED_RESULT
+static UINTVAL null_validate(PARROT_INTERP, ARGIN(const STRING *src))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+#define ASSERT_ARGS_null_compare __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(lhs) \
+ , PARROT_ASSERT_ARG(rhs))
+#define ASSERT_ARGS_null_equal __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(lhs) \
+ , PARROT_ASSERT_ARG(rhs))
+#define ASSERT_ARGS_null_error __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_null_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(s))
+#define ASSERT_ARGS_null_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(src))
+#define ASSERT_ARGS_null_validate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(src))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: static */
+
+
+/*
+
+=item C<static void null_error(PARROT_INTERP)>
+
+Generic encoding function for null strings that throws an exception.
+
+=cut
+
+*/
+
+static void
+null_error(PARROT_INTERP)
+{
+ ASSERT_ARGS(null_error)
+
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
+ "Invalid operation on null string");
+}
+
+
+/*
+
+=item C<static INTVAL null_equal(PARROT_INTERP, const STRING *lhs, const STRING
+*rhs)>
+
+Compares two STRINGs, C<lhs> and C<rhs>. If STRING C<lhs> == C<rhs>,
+returns 1. If C<lhs> != C<rhs> returns 0.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+static INTVAL
+null_equal(PARROT_INTERP, ARGIN(const STRING *lhs), ARGIN(const STRING *rhs))
+{
+ ASSERT_ARGS(null_equal)
+
+ return STRING_length(rhs) == 0;
+}
+
+
+/*
+
+=item C<static INTVAL null_compare(PARROT_INTERP, const STRING *lhs, const
+STRING *rhs)>
+
+Compares two STRINGs, C<lhs> and C<rhs>. Returns -1 if C<lhs> < C<rhs>. Returns
+0 if C<lhs> = C<rhs>. Returns 1 if C<lhs> > C<rhs>.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+static INTVAL
+null_compare(PARROT_INTERP, ARGIN(const STRING *lhs), ARGIN(const STRING *rhs))
+{
+ ASSERT_ARGS(null_compare)
+
+ return STRING_length(rhs) ? -1 : 0;
+}
+
+
+/*
+
+=item C<static size_t null_hash(PARROT_INTERP, const STRING *s, size_t hashval)>
+
+Returns the hashed value of the string, given a seed in hashval.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+static size_t
+null_hash(SHIM_INTERP, ARGIN(const STRING *s), size_t hashval)
+{
+ ASSERT_ARGS(null_hash)
+
+ return hashval;
+}
+
+
+/*
+
+=item C<static UINTVAL null_validate(PARROT_INTERP, const STRING *src)>
+
+Verifies the null string. Always returns 1.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+static UINTVAL
+null_validate(PARROT_INTERP, ARGIN(const STRING *src))
+{
+ ASSERT_ARGS(null_validate)
+ return 1;
+}
+
+
+/*
+
+=item C<static UINTVAL null_scan(PARROT_INTERP, const STRING *src)>
+
+Scans the null string. Always returns 0.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+static UINTVAL
+null_scan(PARROT_INTERP, ARGIN(const STRING *src))
+{
+ ASSERT_ARGS(null_scan)
+ return 0;
+}
+
+
+static STR_VTABLE Parrot_null_encoding = {
+ 0,
+ "null",
+ NULL,
+ 1, /* Max bytes per codepoint */
+
+ (str_vtable_to_encoding_t)null_error,
+ (str_vtable_chr_t)null_error,
+
+ null_equal,
+ null_compare,
+ (str_vtable_index_t)null_error,
+ (str_vtable_rindex_t)null_error,
+ null_hash,
+ null_validate,
+
+ null_scan,
+ (str_vtable_ord_t)null_error,
+ (str_vtable_substr_t)null_error,
+
+ (str_vtable_is_cclass_t)null_error,
+ (str_vtable_find_cclass_t)null_error,
+ (str_vtable_find_not_cclass_t)null_error,
+
+ (str_vtable_get_graphemes_t)null_error,
+ (str_vtable_compose_t)null_error,
+ (str_vtable_decompose_t)null_error,
+
+ (str_vtable_upcase_t)null_error,
+ (str_vtable_downcase_t)null_error,
+ (str_vtable_titlecase_t)null_error,
+ (str_vtable_upcase_first_t)null_error,
+ (str_vtable_downcase_first_t)null_error,
+ (str_vtable_titlecase_first_t)null_error,
+
+ (str_vtable_iter_get_t)null_error,
+ (str_vtable_iter_skip_t)null_error,
+ (str_vtable_iter_get_and_advance_t)null_error,
+ (str_vtable_iter_set_and_advance_t)null_error,
+ (str_vtable_iter_set_position_t)null_error
+};
+
+STR_VTABLE *Parrot_null_encoding_ptr = &Parrot_null_encoding;
+
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
+
Modified: branches/html_cleanup/src/string/encoding/shared.c
==============================================================================
--- branches/html_cleanup/src/string/encoding/shared.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding/shared.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -113,14 +113,18 @@
{
ASSERT_ARGS(encoding_compare)
String_iter l_iter, r_iter;
- UINTVAL min_len, l_len, r_len;
+ const UINTVAL l_len = STRING_length(lhs);
+ const UINTVAL r_len = STRING_length(rhs);
+ UINTVAL min_len;
+
+ if (r_len == 0)
+ return l_len != 0;
+ if (l_len == 0)
+ return -1;
STRING_ITER_INIT(interp, &l_iter);
STRING_ITER_INIT(interp, &r_iter);
- l_len = lhs->strlen;
- r_len = rhs->strlen;
-
min_len = l_len > r_len ? r_len : l_len;
while (l_iter.charpos < min_len) {
@@ -144,7 +148,7 @@
/*
=item C<INTVAL encoding_index(PARROT_INTERP, const STRING *src, const STRING
-*search, UINTVAL offs)>
+*search, INTVAL offset)>
Searches for the first instance of STRING C<search> in STRING C<src>.
returns the position where the substring is found if it is indeed found.
@@ -157,14 +161,18 @@
PARROT_WARN_UNUSED_RESULT
INTVAL
-encoding_index(PARROT_INTERP, ARGIN(const STRING *src), ARGIN(const STRING *search),
- UINTVAL offs)
+encoding_index(PARROT_INTERP, ARGIN(const STRING *src),
+ ARGIN(const STRING *search), INTVAL offset)
{
ASSERT_ARGS(encoding_index)
String_iter start, end;
+ if ((UINTVAL)offset >= STRING_length(src)
+ || !STRING_length(search))
+ return -1;
+
STRING_ITER_INIT(interp, &start);
- STRING_iter_set_position(interp, src, &start, offs);
+ STRING_iter_set_position(interp, src, &start, offset);
return Parrot_str_iter_index(interp, src, &start, &end, search);
}
@@ -173,7 +181,7 @@
/*
=item C<INTVAL encoding_rindex(PARROT_INTERP, const STRING *src, const STRING
-*search_string, UINTVAL offset)>
+*search_string, INTVAL offset)>
Finds the last index of substring C<search_string> in STRING C<src>,
starting from C<offset>. Not implemented.
@@ -185,7 +193,7 @@
PARROT_WARN_UNUSED_RESULT
INTVAL
encoding_rindex(PARROT_INTERP, SHIM(const STRING *src),
- SHIM(const STRING *search_string), SHIM(UINTVAL offset))
+ SHIM(const STRING *search_string), SHIM(INTVAL offset))
{
ASSERT_ARGS(encoding_rindex)
/* TODO: https://trac.parrot.org/parrot/wiki/StringsTasklist Implement this. */
@@ -195,7 +203,7 @@
/*
-=item C<size_t encoding_hash(PARROT_INTERP, const STRING *src, size_t seed)>
+=item C<size_t encoding_hash(PARROT_INTERP, const STRING *src, size_t hashval)>
Computes the hash of the given STRING C<src> with starting seed value C<seed>.
@@ -205,20 +213,23 @@
PARROT_WARN_UNUSED_RESULT
size_t
-encoding_hash(PARROT_INTERP, ARGIN(const STRING *src), size_t seed)
+encoding_hash(PARROT_INTERP, ARGIN(const STRING *src), size_t hashval)
{
ASSERT_ARGS(encoding_hash)
+ DECL_CONST_CAST;
+ STRING * const s = PARROT_const_cast(STRING *, src);
String_iter iter;
- size_t hashval = seed;
STRING_ITER_INIT(interp, &iter);
- while (iter.charpos < src->strlen) {
- const UINTVAL c = STRING_iter_get_and_advance(interp, src, &iter);
+ while (iter.charpos < s->strlen) {
+ const UINTVAL c = STRING_iter_get_and_advance(interp, s, &iter);
hashval += hashval << 5;
hashval += c;
}
+ s->hashval = hashval;
+
return hashval;
}
@@ -348,8 +359,38 @@
/*
-=item C<STRING * encoding_substr(PARROT_INTERP, const STRING *src, UINTVAL
-offset, UINTVAL count)>
+=item C<void encoding_ord_error(PARROT_INTERP, const STRING *s, INTVAL offset)>
+
+Throws the right exception if STRING_ord was called with a wrong index.
+C<offset> is the wrong offset into the string C<s>.
+
+=cut
+
+*/
+
+void
+encoding_ord_error(PARROT_INTERP, ARGIN(const STRING *s), INTVAL offset)
+{
+ ASSERT_ARGS(encoding_ord_error)
+ const UINTVAL len = STRING_length(s);
+ const char *err_msg;
+
+ if (!len)
+ err_msg = "Cannot get character of empty string";
+ else if (offset >= 0)
+ err_msg = "Cannot get character past end of string";
+ else if (offset < 0)
+ err_msg = "Cannot get character before beginning of string";
+
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ORD_OUT_OF_STRING,
+ err_msg);
+}
+
+
+/*
+
+=item C<STRING * encoding_substr(PARROT_INTERP, const STRING *src, INTVAL
+offset, INTVAL length)>
Returns the codepoints in string C<src> at position C<offset> and length
C<count>.
@@ -360,28 +401,51 @@
PARROT_CANNOT_RETURN_NULL
STRING *
-encoding_substr(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
+encoding_substr(PARROT_INTERP, ARGIN(const STRING *src), INTVAL offset, INTVAL length)
{
ASSERT_ARGS(encoding_substr)
-
- STRING * const return_string = Parrot_str_copy(interp, src);
+ const UINTVAL strlen = STRING_length(src);
+ STRING *return_string;
String_iter iter;
UINTVAL start;
+ if (offset < 0)
+ offset += strlen;
+
+ if ((UINTVAL)offset >= strlen || length <= 0) {
+ /* Allow regexes to return $' easily for "aaa" =~ /aaa/ */
+ if ((UINTVAL)offset == strlen || length <= 0)
+ return Parrot_str_new_constant(interp, "");
+
+ Parrot_ex_throw_from_c_args(interp, NULL,
+ EXCEPTION_SUBSTR_OUT_OF_STRING,
+ "Cannot take substr outside string");
+ }
+
+ return_string = Parrot_str_copy(interp, src);
+
+ if (offset == 0 && (UINTVAL)length >= strlen)
+ return return_string;
+
STRING_ITER_INIT(interp, &iter);
if (offset)
STRING_iter_set_position(interp, src, &iter, offset);
- start = iter.bytepos;
- return_string->strstart = (char *)return_string->strstart + start;
+ start = iter.bytepos;
+ return_string->strstart += start;
- if (count)
- STRING_iter_set_position(interp, src, &iter, offset + count);
+ if ((UINTVAL)length >= strlen - (UINTVAL)offset) {
+ return_string->bufused -= start;
+ return_string->strlen -= offset;
+ }
+ else {
+ STRING_iter_set_position(interp, src, &iter, offset + length);
+ return_string->bufused = iter.bytepos - start;
+ return_string->strlen = length;
+ }
- return_string->bufused = iter.bytepos - start;
- return_string->strlen = count;
- return_string->hashval = 0;
+ return_string->hashval = 0;
return return_string;
}
@@ -623,9 +687,16 @@
fixed8_compare(PARROT_INTERP, ARGIN(const STRING *lhs), ARGIN(const STRING *rhs))
{
ASSERT_ARGS(fixed8_compare)
- const UINTVAL l_len = lhs->strlen;
- const UINTVAL r_len = rhs->strlen;
- const UINTVAL min_len = l_len > r_len ? r_len : l_len;
+ const UINTVAL l_len = STRING_length(lhs);
+ const UINTVAL r_len = STRING_length(rhs);
+ UINTVAL min_len;
+
+ if (r_len == 0)
+ return l_len != 0;
+ if (l_len == 0)
+ return -1;
+
+ min_len = l_len > r_len ? r_len : l_len;
if (STRING_max_bytes_per_codepoint(rhs) == 1) {
const int ret_val = memcmp(lhs->strstart, rhs->strstart, min_len);
@@ -658,7 +729,7 @@
/*
=item C<INTVAL fixed8_index(PARROT_INTERP, const STRING *src, const STRING
-*search_string, UINTVAL offset)>
+*search, INTVAL offset)>
Searches for the first instance of STRING C<search> in STRING C<src>.
returns the position where the substring is found if it is indeed found.
@@ -671,26 +742,23 @@
PARROT_WARN_UNUSED_RESULT
INTVAL
fixed8_index(PARROT_INTERP, ARGIN(const STRING *src),
- ARGIN(const STRING *search_string), UINTVAL offset)
+ ARGIN(const STRING *search), INTVAL offset)
{
ASSERT_ARGS(fixed8_index)
INTVAL retval;
- if (STRING_max_bytes_per_codepoint(search_string) != 1) {
- return encoding_index(interp, src, search_string, offset);
- }
+ if ((UINTVAL)offset >= STRING_length(src)
+ || !STRING_length(search))
+ return -1;
- PARROT_ASSERT(STRING_max_bytes_per_codepoint(src) == 1);
- retval = Parrot_byte_index(interp, src,
- search_string, offset);
- return retval;
+ return Parrot_byte_index(interp, src, search, offset);
}
/*
=item C<INTVAL fixed8_rindex(PARROT_INTERP, const STRING *src, const STRING
-*search_string, UINTVAL offset)>
+*search_string, INTVAL offset)>
Searches for the last instance of STRING C<search_string> in STRING
C<src>. Starts searching at C<offset>.
@@ -702,7 +770,7 @@
PARROT_WARN_UNUSED_RESULT
INTVAL
fixed8_rindex(PARROT_INTERP, ARGIN(const STRING *src),
- ARGIN(const STRING *search_string), UINTVAL offset)
+ ARGIN(const STRING *search_string), INTVAL offset)
{
ASSERT_ARGS(fixed8_rindex)
INTVAL retval;
@@ -719,7 +787,7 @@
/*
-=item C<size_t fixed8_hash(PARROT_INTERP, const STRING *s, size_t hashval)>
+=item C<size_t fixed8_hash(PARROT_INTERP, const STRING *src, size_t hashval)>
Returns the hashed value of the string, given a seed in hashval.
@@ -729,17 +797,24 @@
PARROT_WARN_UNUSED_RESULT
size_t
-fixed8_hash(SHIM_INTERP, ARGIN(const STRING *s), size_t hashval)
+fixed8_hash(SHIM_INTERP, ARGIN(const STRING *src), size_t hashval)
{
ASSERT_ARGS(fixed8_hash)
- const unsigned char *pos = (const unsigned char *)s->strstart;
- UINTVAL len = s->strlen;
+ DECL_CONST_CAST;
+ STRING * const s = PARROT_const_cast(STRING *, src);
+ const unsigned char *pos;
+ UINTVAL len;
+
+ pos = (const unsigned char *)s->strstart;
+ len = s->strlen;
while (len--) {
hashval += hashval << 5;
hashval += *(pos++);
}
+ s->hashval = hashval;
+
return hashval;
}
@@ -766,7 +841,7 @@
/*
-=item C<UINTVAL fixed8_ord(PARROT_INTERP, const STRING *src, UINTVAL offset)>
+=item C<UINTVAL fixed8_ord(PARROT_INTERP, const STRING *src, INTVAL idx)>
codepoints are bytes, so delegate
@@ -776,30 +851,28 @@
PARROT_WARN_UNUSED_RESULT
UINTVAL
-fixed8_ord(PARROT_INTERP, ARGIN(const STRING *src),
- UINTVAL offset)
+fixed8_ord(PARROT_INTERP, ARGIN(const STRING *src), INTVAL idx)
{
ASSERT_ARGS(fixed8_ord)
- const unsigned char * const buf = (unsigned char *)src->strstart;
+ const UINTVAL len = STRING_length(src);
- if (offset >= src->bufused) {
-/* Parrot_ex_throw_from_c_args(interp, NULL, 0,
- "fixed8_ord past the end of the buffer (%i of %i)",
- offset, src->bufused); */
- return 0;
- }
+ if (idx < 0)
+ idx += len;
+
+ if ((UINTVAL)idx >= len)
+ encoding_ord_error(interp, src, idx);
- return buf[offset];
+ return (unsigned char)src->strstart[idx];
}
/*
-=item C<STRING * fixed8_substr(PARROT_INTERP, const STRING *src, UINTVAL offset,
-UINTVAL count)>
+=item C<STRING * fixed_substr(PARROT_INTERP, const STRING *src, INTVAL offset,
+INTVAL length)>
Returns the codepoints in string C<src> at position C<offset> and length
-C<count>.
+C<count>. Works for all fixed size encodings.
=cut
@@ -808,16 +881,41 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
STRING *
-fixed8_substr(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
+fixed_substr(PARROT_INTERP, ARGIN(const STRING *src), INTVAL offset, INTVAL length)
{
- ASSERT_ARGS(fixed8_substr)
- STRING * const return_string = Parrot_str_copy(interp, src);
+ ASSERT_ARGS(fixed_substr)
+ const UINTVAL strlen = STRING_length(src);
+ STRING *return_string;
+ UINTVAL maxlen, bytes_per_codepoint;
+
+ if (offset < 0)
+ offset += strlen;
+
+ if ((UINTVAL)offset >= strlen || length <= 0) {
+ /* Allow regexes to return $' easily for "aaa" =~ /aaa/ */
+ if ((UINTVAL)offset == strlen || length <= 0)
+ return Parrot_str_new_constant(interp, "");
+
+ Parrot_ex_throw_from_c_args(interp, NULL,
+ EXCEPTION_SUBSTR_OUT_OF_STRING,
+ "Cannot take substr outside string");
+ }
+
+ return_string = Parrot_str_copy(interp, src);
+
+ if (offset == 0 && (UINTVAL)length >= strlen)
+ return return_string;
+
+ bytes_per_codepoint = src->encoding->max_bytes_per_codepoint;
+ maxlen = strlen - offset;
+
+ if ((UINTVAL)length > maxlen)
+ length = maxlen;
- return_string->encoding = src->encoding;
- return_string->strstart = (char *)return_string->strstart + offset;
- return_string->bufused = count;
- return_string->strlen = count;
- return_string->hashval = 0;
+ return_string->strstart += offset * bytes_per_codepoint;
+ return_string->bufused = length * bytes_per_codepoint;
+ return_string->strlen = length;
+ return_string->hashval = 0;
return return_string;
}
@@ -1123,7 +1221,7 @@
/*
* XXX troubles:
- * t/op/string_cs_45 upcase unicode:"\u01f0"
+ * t/op/string_cs_45 upcase utf8:"\u01f0"
* this creates \u004a \u030c J+NON-SPACING HACEK
* the string needs resizing, *if* the src buffer is
* too short. *But* with icu 3.2/3.4 the src string is
Modified: branches/html_cleanup/src/string/encoding/shared.h
==============================================================================
--- branches/html_cleanup/src/string/encoding/shared.h Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding/shared.h Sun Oct 24 12:14:32 2010 (r49645)
@@ -1,9 +1,9 @@
-/* fixed_8.h
+/* shared.h
* Copyright (C) 2004-2007, Parrot Foundation.
* SVN Info
* $Id$
* Overview:
- * This is the header for the 8-bit fixed-width encoding
+ * This is the header for general encoding functions
* Data Structure and Algorithms:
* History:
* Notes:
@@ -64,7 +64,9 @@
__attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
-size_t encoding_hash(PARROT_INTERP, ARGIN(const STRING *src), size_t seed)
+size_t encoding_hash(PARROT_INTERP,
+ ARGIN(const STRING *src),
+ size_t hashval)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -72,7 +74,7 @@
INTVAL encoding_index(PARROT_INTERP,
ARGIN(const STRING *src),
ARGIN(const STRING *search),
- UINTVAL offs)
+ INTVAL offset)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
@@ -85,11 +87,17 @@
__attribute__nonnull__(1)
__attribute__nonnull__(3);
+void encoding_ord_error(PARROT_INTERP,
+ ARGIN(const STRING *s),
+ INTVAL offset)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
PARROT_WARN_UNUSED_RESULT
INTVAL encoding_rindex(PARROT_INTERP,
SHIM(const STRING *src),
SHIM(const STRING *search_string),
- NULLOK(UINTVAL offset))
+ NULLOK(INTVAL offset))
__attribute__nonnull__(1);
UINTVAL encoding_scan(PARROT_INTERP, ARGIN(const STRING *src))
@@ -99,8 +107,8 @@
PARROT_CANNOT_RETURN_NULL
STRING * encoding_substr(PARROT_INTERP,
ARGIN(const STRING *src),
- UINTVAL offset,
- UINTVAL count)
+ INTVAL offset,
+ INTVAL length)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -126,14 +134,14 @@
__attribute__nonnull__(3);
PARROT_WARN_UNUSED_RESULT
-size_t fixed8_hash(SHIM_INTERP, ARGIN(const STRING *s), size_t hashval)
+size_t fixed8_hash(SHIM_INTERP, ARGIN(const STRING *src), size_t hashval)
__attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
INTVAL fixed8_index(PARROT_INTERP,
ARGIN(const STRING *src),
- ARGIN(const STRING *search_string),
- UINTVAL offset)
+ ARGIN(const STRING *search),
+ INTVAL offset)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
@@ -181,7 +189,7 @@
FUNC_MODIFIES(*iter);
PARROT_WARN_UNUSED_RESULT
-UINTVAL fixed8_ord(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset)
+UINTVAL fixed8_ord(PARROT_INTERP, ARGIN(const STRING *src), INTVAL idx)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -189,7 +197,7 @@
INTVAL fixed8_rindex(PARROT_INTERP,
ARGIN(const STRING *src),
ARGIN(const STRING *search_string),
- UINTVAL offset)
+ INTVAL offset)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
@@ -201,10 +209,10 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
-STRING * fixed8_substr(PARROT_INTERP,
+STRING * fixed_substr(PARROT_INTERP,
ARGIN(const STRING *src),
- UINTVAL offset,
- UINTVAL count)
+ INTVAL offset,
+ INTVAL length)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -277,6 +285,9 @@
#define ASSERT_ARGS_encoding_is_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
+#define ASSERT_ARGS_encoding_ord_error __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_encoding_rindex __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_encoding_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -297,11 +308,11 @@
, PARROT_ASSERT_ARG(lhs) \
, PARROT_ASSERT_ARG(rhs))
#define ASSERT_ARGS_fixed8_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(s))
+ PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_fixed8_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src) \
- , PARROT_ASSERT_ARG(search_string))
+ , PARROT_ASSERT_ARG(search))
#define ASSERT_ARGS_fixed8_iter_get __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(str) \
@@ -330,7 +341,7 @@
#define ASSERT_ARGS_fixed8_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_fixed8_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+#define ASSERT_ARGS_fixed_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_unicode_chr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
Modified: branches/html_cleanup/src/string/encoding/ucs2.c
==============================================================================
--- branches/html_cleanup/src/string/encoding/ucs2.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding/ucs2.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -8,7 +8,7 @@
=head1 DESCRIPTION
-UCS-2 encoding with the help of the ICU library.
+UCS-2 encoding
=head2 Functions
@@ -21,74 +21,54 @@
#include "parrot/parrot.h"
#include "shared.h"
-#if !PARROT_HAS_ICU
-PARROT_DOES_NOT_RETURN
-static void no_ICU_lib(PARROT_INTERP) /* HEADERIZER SKIP */
-{
- Parrot_ex_throw_from_c_args(interp, NULL,
- EXCEPTION_LIBRARY_ERROR,
- "no ICU lib loaded");
-}
-#endif
-
/* HEADERIZER HFILE: none */
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static size_t ucs2_hash(PARROT_INTERP,
- ARGIN(const STRING *s),
+static size_t ucs2_hash(SHIM_INTERP,
+ ARGIN(const STRING *src),
size_t hashval)
- __attribute__nonnull__(1)
__attribute__nonnull__(2);
-static UINTVAL ucs2_iter_get(PARROT_INTERP,
+static UINTVAL ucs2_iter_get(SHIM_INTERP,
ARGIN(const STRING *str),
ARGIN(const String_iter *i),
INTVAL offset)
- __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
-static UINTVAL ucs2_iter_get_and_advance(PARROT_INTERP,
+static UINTVAL ucs2_iter_get_and_advance(SHIM_INTERP,
ARGIN(const STRING *str),
ARGMOD(String_iter *i))
- __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*i);
-static void ucs2_iter_set_and_advance(PARROT_INTERP,
+static void ucs2_iter_set_and_advance(SHIM_INTERP,
ARGMOD(STRING *str),
ARGMOD(String_iter *i),
UINTVAL c)
- __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*str)
FUNC_MODIFIES(*i);
-static void ucs2_iter_set_position(PARROT_INTERP,
- ARGIN(const STRING *str),
+static void ucs2_iter_set_position(SHIM_INTERP,
+ SHIM(const STRING *str),
ARGMOD(String_iter *i),
UINTVAL n)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*i);
-static void ucs2_iter_skip(PARROT_INTERP,
- ARGIN(const STRING *str),
+static void ucs2_iter_skip(SHIM_INTERP,
+ SHIM(const STRING *str),
ARGMOD(String_iter *i),
INTVAL skip)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*i);
-static UINTVAL ucs2_ord(PARROT_INTERP,
- ARGIN(const STRING *src),
- UINTVAL offset)
+static UINTVAL ucs2_ord(PARROT_INTERP, ARGIN(const STRING *src), INTVAL idx)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -99,61 +79,37 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
-static STRING * ucs2_substr(PARROT_INTERP,
- ARGIN(const STRING *src),
- UINTVAL offset,
- UINTVAL count)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
static STRING * ucs2_to_encoding(PARROT_INTERP, ARGIN(const STRING *src))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
#define ASSERT_ARGS_ucs2_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s))
+ PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_ucs2_iter_get __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
+ PARROT_ASSERT_ARG(str) \
, PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs2_iter_get_and_advance __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
+ PARROT_ASSERT_ARG(str) \
, PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs2_iter_set_and_advance __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
+ PARROT_ASSERT_ARG(str) \
, PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs2_iter_set_position __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
- , PARROT_ASSERT_ARG(i))
+ PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs2_iter_skip __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
- , PARROT_ASSERT_ARG(i))
+ PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs2_ord __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_ucs2_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_ucs2_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_ucs2_to_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
-#if PARROT_HAS_ICU
-# include <unicode/ustring.h>
-#endif
-
#define UNIMPL Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED, \
"unimpl ucs2")
@@ -201,19 +157,12 @@
ucs2_scan(PARROT_INTERP, ARGIN(const STRING *src))
{
ASSERT_ARGS(ucs2_scan)
-#if PARROT_HAS_ICU
- UNUSED(interp);
- return src->bufused / sizeof (UChar);
-#else
- UNUSED(src);
- no_ICU_lib(interp);
-#endif
+ return src->bufused >> 1;
}
/*
-=item C<static UINTVAL ucs2_ord(PARROT_INTERP, const STRING *src, UINTVAL
-offset)>
+=item C<static UINTVAL ucs2_ord(PARROT_INTERP, const STRING *src, INTVAL idx)>
Returns the codepoint in string C<src> at position C<offset>.
@@ -222,54 +171,24 @@
*/
static UINTVAL
-ucs2_ord(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset)
+ucs2_ord(PARROT_INTERP, ARGIN(const STRING *src), INTVAL idx)
{
ASSERT_ARGS(ucs2_ord)
-#if PARROT_HAS_ICU
- const UChar * const s = (const UChar*) src->strstart;
- UNUSED(interp);
- return s[offset];
-#else
- UNUSED(offset);
- UNUSED(src);
- no_ICU_lib(interp);
-#endif
-}
+ const UINTVAL len = STRING_length(src);
+ const Parrot_UInt2 *s;
-/*
-
-=item C<static STRING * ucs2_substr(PARROT_INTERP, const STRING *src, UINTVAL
-offset, UINTVAL count)>
-
-Returns the codepoints in string C<src> at position C<offset> and length
-C<count>.
+ if (idx < 0)
+ idx += len;
-=cut
+ if ((UINTVAL)idx >= len)
+ encoding_ord_error(interp, src, idx);
-*/
+ s = (const Parrot_UInt2 *)src->strstart;
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-ucs2_substr(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
-{
- ASSERT_ARGS(ucs2_substr)
- STRING * const return_string = Parrot_str_copy(interp, src);
-
-#if PARROT_HAS_ICU
- return_string->strstart = (char*)src->strstart + offset * sizeof (UChar);
- return_string->bufused = count * sizeof (UChar);
- return_string->strlen = count;
- return_string->hashval = 0;
- return return_string;
-#else
- UNUSED(src);
- UNUSED(offset);
- UNUSED(count);
- no_ICU_lib(interp);
-#endif
+ return s[idx];
}
+
/*
=item C<static UINTVAL ucs2_iter_get(PARROT_INTERP, const STRING *str, const
@@ -282,11 +201,13 @@
*/
static UINTVAL
-ucs2_iter_get(PARROT_INTERP,
+ucs2_iter_get(SHIM_INTERP,
ARGIN(const STRING *str), ARGIN(const String_iter *i), INTVAL offset)
{
ASSERT_ARGS(ucs2_iter_get)
- return ucs2_ord(interp, str, i->charpos + offset);
+ const Parrot_UInt2 * const s = (const Parrot_UInt2 *)str->strstart;
+
+ return s[i->charpos + offset];
}
/*
@@ -301,20 +222,13 @@
*/
static void
-ucs2_iter_skip(PARROT_INTERP,
- ARGIN(const STRING *str), ARGMOD(String_iter *i), INTVAL skip)
+ucs2_iter_skip(SHIM_INTERP,
+ SHIM(const STRING *str), ARGMOD(String_iter *i), INTVAL skip)
{
ASSERT_ARGS(ucs2_iter_skip)
- UNUSED(str);
-#if PARROT_HAS_ICU
i->charpos += skip;
- i->bytepos += skip * sizeof (UChar);
-#else
- UNUSED(i);
- UNUSED(skip);
- no_ICU_lib(interp);
-#endif
+ i->bytepos += skip * 2;
}
/*
@@ -329,28 +243,17 @@
*/
static UINTVAL
-ucs2_iter_get_and_advance(PARROT_INTERP,
+ucs2_iter_get_and_advance(SHIM_INTERP,
ARGIN(const STRING *str), ARGMOD(String_iter *i))
{
ASSERT_ARGS(ucs2_iter_get_and_advance)
+ const Parrot_UInt2 * const s = (Parrot_UInt2 *)str->strstart;
+ const UINTVAL c = s[i->charpos];
-#if PARROT_HAS_ICU
- UChar * const s = (UChar*) str->strstart;
- size_t pos = i->bytepos / sizeof (UChar);
-
- /* TODO either make sure that we don't go past end or use SAFE
- * iter versions
- */
- const UChar c = s[pos++];
i->charpos++;
- i->bytepos = pos * sizeof (UChar);
+ i->bytepos += 2;
+
return c;
-#else
- UNUSED(str);
- UNUSED(i);
- no_ICU_lib(interp);
- return (UINTVAL)0; /* Stop the static analyzers from panicing */
-#endif
}
/*
@@ -366,23 +269,16 @@
*/
static void
-ucs2_iter_set_and_advance(PARROT_INTERP,
+ucs2_iter_set_and_advance(SHIM_INTERP,
ARGMOD(STRING *str), ARGMOD(String_iter *i), UINTVAL c)
{
ASSERT_ARGS(ucs2_iter_set_and_advance)
+ Parrot_UInt2 * const s = (Parrot_UInt2 *) str->strstart;
+
+ s[i->charpos] = c;
-#if PARROT_HAS_ICU
- UChar * const s = (UChar*) str->strstart;
- UINTVAL pos = i->bytepos / sizeof (UChar);
- s[pos++] = (UChar)c;
i->charpos++;
- i->bytepos = pos * sizeof (UChar);
-#else
- UNUSED(str);
- UNUSED(i);
- UNUSED(c);
- no_ICU_lib(interp);
-#endif
+ i->bytepos += 2;
}
/*
@@ -397,25 +293,19 @@
*/
static void
-ucs2_iter_set_position(PARROT_INTERP,
- ARGIN(const STRING *str), ARGMOD(String_iter *i), UINTVAL n)
+ucs2_iter_set_position(SHIM_INTERP,
+ SHIM(const STRING *str), ARGMOD(String_iter *i), UINTVAL n)
{
ASSERT_ARGS(ucs2_iter_set_position)
- UNUSED(str);
-#if PARROT_HAS_ICU
i->charpos = n;
- i->bytepos = n * sizeof (UChar);
-#else
- UNUSED(i);
- UNUSED(n);
- no_ICU_lib(interp);
-#endif
+ i->bytepos = n * 2;
}
/*
-=item C<static size_t ucs2_hash(PARROT_INTERP, const STRING *s, size_t hashval)>
+=item C<static size_t ucs2_hash(PARROT_INTERP, const STRING *src, size_t
+hashval)>
Returns the hashed value of the string, given a seed in hashval.
@@ -424,27 +314,25 @@
*/
static size_t
-ucs2_hash(PARROT_INTERP, ARGIN(const STRING *s), size_t hashval)
+ucs2_hash(SHIM_INTERP, ARGIN(const STRING *src), size_t hashval)
{
ASSERT_ARGS(ucs2_hash)
-#if PARROT_HAS_ICU
- const UChar *pos = (const UChar*) s->strstart;
- UINTVAL len = s->strlen;
- UNUSED(interp);
+ DECL_CONST_CAST;
+ STRING * const s = PARROT_const_cast(STRING *, src);
+ const Parrot_UInt2 *pos;
+ UINTVAL len;
+
+ pos = (const Parrot_UInt2*)s->strstart;
+ len = s->strlen;
while (len--) {
hashval += hashval << 5;
hashval += *(pos++);
}
- return hashval;
-
-#else
- UNUSED(s);
- UNUSED(hashval);
+ s->hashval = hashval;
- no_ICU_lib(interp);
-#endif
+ return hashval;
}
static STR_VTABLE Parrot_ucs2_encoding = {
@@ -465,7 +353,7 @@
ucs2_scan,
ucs2_ord,
- ucs2_substr,
+ fixed_substr,
encoding_is_cclass,
encoding_find_cclass,
Modified: branches/html_cleanup/src/string/encoding/ucs4.c
==============================================================================
--- branches/html_cleanup/src/string/encoding/ucs4.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding/ucs4.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -8,7 +8,7 @@
=head1 DESCRIPTION
-UCS-4 encoding with the help of the ICU library.
+UCS-4 encoding
=head2 Functions
@@ -21,89 +21,59 @@
#include "parrot/parrot.h"
#include "shared.h"
-#if !PARROT_HAS_ICU
-PARROT_DOES_NOT_RETURN
-static void no_ICU_lib(PARROT_INTERP) /* HEADERIZER SKIP */
-{
- Parrot_ex_throw_from_c_args(interp, NULL,
- EXCEPTION_LIBRARY_ERROR,
- "no ICU lib loaded");
-}
-#endif
-
/* HEADERIZER HFILE: none */
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static size_t ucs4_hash(PARROT_INTERP,
- ARGIN(const STRING *s),
+static size_t ucs4_hash(SHIM_INTERP,
+ ARGIN(const STRING *src),
size_t hashval)
- __attribute__nonnull__(1)
__attribute__nonnull__(2);
-static UINTVAL ucs4_iter_get(PARROT_INTERP,
+static UINTVAL ucs4_iter_get(SHIM_INTERP,
ARGIN(const STRING *str),
ARGIN(const String_iter *i),
INTVAL offset)
- __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
-static UINTVAL ucs4_iter_get_and_advance(PARROT_INTERP,
+static UINTVAL ucs4_iter_get_and_advance(SHIM_INTERP,
ARGIN(const STRING *str),
ARGMOD(String_iter *i))
- __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*i);
-static void ucs4_iter_set_and_advance(PARROT_INTERP,
+static void ucs4_iter_set_and_advance(SHIM_INTERP,
ARGMOD(STRING *str),
ARGMOD(String_iter *i),
UINTVAL c)
- __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*str)
FUNC_MODIFIES(*i);
-static void ucs4_iter_set_position(PARROT_INTERP,
- ARGIN(const STRING *str),
+static void ucs4_iter_set_position(SHIM_INTERP,
+ SHIM(const STRING *str),
ARGMOD(String_iter *i),
UINTVAL n)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*i);
-static void ucs4_iter_skip(PARROT_INTERP,
- ARGIN(const STRING *str),
+static void ucs4_iter_skip(SHIM_INTERP,
+ SHIM(const STRING *str),
ARGMOD(String_iter *i),
INTVAL skip)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*i);
-static UINTVAL ucs4_ord(PARROT_INTERP,
- ARGIN(const STRING *src),
- UINTVAL offset)
+static UINTVAL ucs4_ord(PARROT_INTERP, ARGIN(const STRING *src), INTVAL idx)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
-static UINTVAL ucs4_scan(PARROT_INTERP, ARGIN(const STRING *src))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING * ucs4_substr(PARROT_INTERP,
- ARGIN(const STRING *src),
- UINTVAL offset,
- UINTVAL count)
- __attribute__nonnull__(1)
+static UINTVAL ucs4_scan(SHIM_INTERP, ARGIN(const STRING *src))
__attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
@@ -113,47 +83,31 @@
__attribute__nonnull__(2);
#define ASSERT_ARGS_ucs4_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(s))
+ PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_ucs4_iter_get __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
+ PARROT_ASSERT_ARG(str) \
, PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs4_iter_get_and_advance __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
+ PARROT_ASSERT_ARG(str) \
, PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs4_iter_set_and_advance __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
+ PARROT_ASSERT_ARG(str) \
, PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs4_iter_set_position __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
- , PARROT_ASSERT_ARG(i))
+ PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs4_iter_skip __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(str) \
- , PARROT_ASSERT_ARG(i))
+ PARROT_ASSERT_ARG(i))
#define ASSERT_ARGS_ucs4_ord __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_ucs4_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_ucs4_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
+ PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_ucs4_to_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
-#if PARROT_HAS_ICU
-# include <unicode/ustring.h>
-#endif
-
/*
@@ -171,30 +125,40 @@
ucs4_to_encoding(PARROT_INTERP, ARGIN(const STRING *src))
{
ASSERT_ARGS(ucs4_to_encoding)
-#if PARROT_HAS_ICU
- if (src->encoding == Parrot_ucs4_encoding_ptr) {
+ UINTVAL len;
+ STRING *res;
+ Parrot_UInt4 *buf;
+
+ if (src->encoding == Parrot_ucs4_encoding_ptr)
return Parrot_str_clone(interp, src);
+
+ len = STRING_length(src);
+ res = Parrot_str_new_init(interp, NULL, len * 4,
+ Parrot_ucs4_encoding_ptr, 0);
+ buf = (Parrot_UInt4 *) res->strstart;
+
+ if (STRING_max_bytes_per_codepoint(src) == 1) {
+ const unsigned char *s = (const unsigned char *)src->strstart;
+ UINTVAL i;
+
+ for (i = 0; i < len; i++) {
+ buf[i] = s[i];
+ }
}
else {
- UINTVAL len = Parrot_str_length(interp, src);
- STRING *res = Parrot_str_new_init(interp, NULL, len * sizeof (UChar32),
- Parrot_ucs4_encoding_ptr, 0);
- UChar32 *buf = (UChar32 *) res->strstart;
- UINTVAL offs;
- /* TODO: use an iterator */
- for (offs = 0; offs < len; offs++){
- buf[offs] = STRING_ord(interp, src, offs);
- };
- res->strlen = len;
- res->bufused = len * sizeof (UChar32);
+ String_iter iter;
- return res;
+ STRING_ITER_INIT(interp, &iter);
+
+ while (iter.charpos < len) {
+ buf[iter.charpos] = STRING_iter_get_and_advance(interp, src, &iter);
+ }
}
-#else
- UNUSED(src);
- no_ICU_lib(interp);
-#endif
+ res->strlen = len;
+ res->bufused = len * 4;
+
+ return res;
}
@@ -210,23 +174,17 @@
PARROT_WARN_UNUSED_RESULT
static UINTVAL
-ucs4_scan(PARROT_INTERP, ARGIN(const STRING *src))
+ucs4_scan(SHIM_INTERP, ARGIN(const STRING *src))
{
ASSERT_ARGS(ucs4_scan)
-#if PARROT_HAS_ICU
- UNUSED(interp);
- return src->bufused / sizeof (UChar32);
-#else
- UNUSED(src);
- no_ICU_lib(interp);
-#endif
+
+ return src->bufused >> 2;
}
/*
-=item C<static UINTVAL ucs4_ord(PARROT_INTERP, const STRING *src, UINTVAL
-offset)>
+=item C<static UINTVAL ucs4_ord(PARROT_INTERP, const STRING *src, INTVAL idx)>
Returns the codepoint in string C<src> at position C<offset>.
@@ -235,48 +193,21 @@
*/
static UINTVAL
-ucs4_ord(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset)
+ucs4_ord(PARROT_INTERP, ARGIN(const STRING *src), INTVAL idx)
{
ASSERT_ARGS(ucs4_ord)
-#if PARROT_HAS_ICU
- const UChar32 * const s = (const UChar32*) src->strstart;
- UNUSED(interp);
- return s[offset];
-#else
- UNUSED(offset);
- UNUSED(src);
- no_ICU_lib(interp);
-#endif
-}
-
+ const UINTVAL len = STRING_length(src);
+ const Parrot_UInt4 *s;
-/*
-
-=item C<static STRING * ucs4_substr(PARROT_INTERP, const STRING *src, UINTVAL
-offset, UINTVAL count)>
+ if (idx < 0)
+ idx += len;
-Returns the C<count> codepoints stored at position C<offset> in string
-C<src> as a new string.
+ if ((UINTVAL)idx >= len)
+ encoding_ord_error(interp, src, idx);
-=cut
+ s = (const Parrot_UInt4 *)src->strstart;
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static STRING *
-ucs4_substr(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
-{
- ASSERT_ARGS(ucs4_substr)
-#if PARROT_HAS_ICU
- return Parrot_str_new_init(interp, (char*)src->strstart + offset * sizeof (UChar32),
- count * sizeof (UChar32), src->encoding, 0);
-#else
- UNUSED(src);
- UNUSED(offset);
- UNUSED(count);
- no_ICU_lib(interp);
-#endif
+ return s[idx];
}
@@ -292,11 +223,13 @@
*/
static UINTVAL
-ucs4_iter_get(PARROT_INTERP,
+ucs4_iter_get(SHIM_INTERP,
ARGIN(const STRING *str), ARGIN(const String_iter *i), INTVAL offset)
{
ASSERT_ARGS(ucs4_iter_get)
- return ucs4_ord(interp, str, i->charpos + offset);
+ const Parrot_UInt4 * const s = (const Parrot_UInt4 *)str->strstart;
+
+ return s[i->charpos + offset];
}
@@ -312,20 +245,13 @@
*/
static void
-ucs4_iter_skip(PARROT_INTERP,
- ARGIN(const STRING *str), ARGMOD(String_iter *i), INTVAL skip)
+ucs4_iter_skip(SHIM_INTERP,
+ SHIM(const STRING *str), ARGMOD(String_iter *i), INTVAL skip)
{
ASSERT_ARGS(ucs4_iter_skip)
- UNUSED(str);
-#if PARROT_HAS_ICU
i->charpos += skip;
- i->bytepos += skip * sizeof (UChar32);
-#else
- UNUSED(i);
- UNUSED(skip);
- no_ICU_lib(interp);
-#endif
+ i->bytepos += skip * 4;
}
@@ -341,22 +267,17 @@
*/
static UINTVAL
-ucs4_iter_get_and_advance(PARROT_INTERP,
+ucs4_iter_get_and_advance(SHIM_INTERP,
ARGIN(const STRING *str), ARGMOD(String_iter *i))
{
ASSERT_ARGS(ucs4_iter_get_and_advance)
+ const Parrot_UInt4 * const s = (const Parrot_UInt4 *)str->strstart;
+ const UINTVAL c = s[i->charpos];
+
+ i->charpos++;
+ i->bytepos += 4;
-#if PARROT_HAS_ICU
- const UChar32 * const s = (const UChar32*) str->strstart;
- const UChar32 c = s[i->charpos++];
- i->bytepos += sizeof (UChar32);
return c;
-#else
- UNUSED(str);
- UNUSED(i);
- no_ICU_lib(interp);
- return (UINTVAL)0; /* Stop the static analyzers from panicing */
-#endif
}
@@ -373,21 +294,16 @@
*/
static void
-ucs4_iter_set_and_advance(PARROT_INTERP,
+ucs4_iter_set_and_advance(SHIM_INTERP,
ARGMOD(STRING *str), ARGMOD(String_iter *i), UINTVAL c)
{
ASSERT_ARGS(ucs4_iter_set_and_advance)
+ Parrot_UInt4 * const s = (Parrot_UInt4 *)str->strstart;
-#if PARROT_HAS_ICU
- UChar32 * const s = (UChar32*) str->strstart;
- s[i->charpos++] = (UChar32)c;
- i->bytepos += sizeof (UChar32);
-#else
- UNUSED(str);
- UNUSED(i);
- UNUSED(c);
- no_ICU_lib(interp);
-#endif
+ s[i->charpos] = c;
+
+ i->charpos++;
+ i->bytepos += 4;
}
@@ -403,26 +319,20 @@
*/
static void
-ucs4_iter_set_position(PARROT_INTERP,
- ARGIN(const STRING *str), ARGMOD(String_iter *i), UINTVAL n)
+ucs4_iter_set_position(SHIM_INTERP,
+ SHIM(const STRING *str), ARGMOD(String_iter *i), UINTVAL n)
{
ASSERT_ARGS(ucs4_iter_set_position)
- UNUSED(str);
-#if PARROT_HAS_ICU
i->charpos = n;
- i->bytepos = n * sizeof (UChar32);
-#else
- UNUSED(i);
- UNUSED(n);
- no_ICU_lib(interp);
-#endif
+ i->bytepos = n * 4;
}
/*
-=item C<static size_t ucs4_hash(PARROT_INTERP, const STRING *s, size_t hashval)>
+=item C<static size_t ucs4_hash(PARROT_INTERP, const STRING *src, size_t
+hashval)>
Returns the hashed value of the string, given a seed in hashval.
@@ -431,18 +341,24 @@
*/
static size_t
-ucs4_hash(PARROT_INTERP, ARGIN(const STRING *s), size_t hashval)
+ucs4_hash(SHIM_INTERP, ARGIN(const STRING *src), size_t hashval)
{
ASSERT_ARGS(ucs4_hash)
- const Parrot_UInt4 *pos = (const Parrot_UInt4 *) s->strstart;
- UINTVAL len = s->strlen;
- UNUSED(interp);
+ DECL_CONST_CAST;
+ STRING * const s = PARROT_const_cast(STRING *, src);
+ const Parrot_UInt4 *pos;
+ UINTVAL len;
+
+ pos = (const Parrot_UInt4 *)s->strstart;
+ len = s->strlen;
while (len--) {
hashval += hashval << 5;
hashval += *(pos++);
}
+ s->hashval = hashval;
+
return hashval;
}
@@ -465,7 +381,7 @@
ucs4_scan,
ucs4_ord,
- ucs4_substr,
+ fixed_substr,
encoding_is_cclass,
encoding_find_cclass,
Modified: branches/html_cleanup/src/string/encoding/utf16.c
==============================================================================
--- branches/html_cleanup/src/string/encoding/utf16.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding/utf16.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -73,7 +73,7 @@
static UINTVAL utf16_ord(PARROT_INTERP,
ARGIN(const STRING *src),
- UINTVAL offset)
+ INTVAL idx)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -86,8 +86,8 @@
PARROT_CANNOT_RETURN_NULL
static STRING * utf16_substr(PARROT_INTERP,
ARGIN(const STRING *src),
- UINTVAL offset,
- UINTVAL count)
+ INTVAL offset,
+ INTVAL length)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -160,13 +160,9 @@
utf16_to_encoding(PARROT_INTERP, ARGIN(const STRING *src))
{
ASSERT_ARGS(utf16_to_encoding)
-#if PARROT_HAS_ICU
- UErrorCode err;
- int dest_len;
- UChar *p;
-#endif
- int src_len;
- STRING *result;
+ int src_len, dest_len;
+ Parrot_UInt2 *p;
+ STRING *result;
if (src->encoding == Parrot_utf16_encoding_ptr
|| src->encoding == Parrot_ucs2_encoding_ptr)
@@ -174,56 +170,58 @@
* and downcase functions assume to get an unshared buffer */
return Parrot_str_clone(interp, src);
- result = Parrot_gc_new_string_header(interp, 0);
+ result = Parrot_gc_new_string_header(interp, 0);
+ src_len = STRING_length(src);
- /*
- * TODO adapt string creation functions
- */
- src_len = src->strlen;
if (!src_len) {
result->encoding = Parrot_ucs2_encoding_ptr;
- result->strlen = result->bufused = 0;
return result;
}
-#if PARROT_HAS_ICU
- Parrot_gc_allocate_string_storage(interp, result, sizeof (UChar) * src_len);
- p = (UChar *)result->strstart;
- if (src->encoding == Parrot_latin1_encoding_ptr ||
- src->encoding == Parrot_ascii_encoding_ptr) {
- for (dest_len = 0; dest_len < (int)src->strlen; ++dest_len) {
- p[dest_len] = (UChar)((unsigned char*)src->strstart)[dest_len];
+ Parrot_gc_allocate_string_storage(interp, result, 2 * src_len);
+ p = (Parrot_UInt2 *)result->strstart;
+
+ if (STRING_max_bytes_per_codepoint(src) == 1) {
+ for (dest_len = 0; dest_len < src_len; ++dest_len) {
+ p[dest_len] = (unsigned char)src->strstart[dest_len];
}
}
- else {
- err = U_ZERO_ERROR;
- u_strFromUTF8(p, src_len,
- &dest_len, src->strstart, src->bufused, &err);
+ else if (src->encoding == Parrot_utf8_encoding_ptr) {
+#if PARROT_HAS_ICU
+ UErrorCode err = U_ZERO_ERROR;
+
+ u_strFromUTF8(p, src_len, &dest_len, src->strstart, src->bufused, &err);
+
if (!U_SUCCESS(err)) {
/*
* have to resize - required len in UChars is in dest_len
*/
- result->bufused = dest_len * sizeof (UChar);
- Parrot_gc_reallocate_string_storage(interp, result,
- sizeof (UChar) * dest_len);
- p = (UChar *)result->strstart;
- u_strFromUTF8(p, dest_len,
- &dest_len, src->strstart, src->bufused, &err);
+ result->bufused = 2 * dest_len;
+ Parrot_gc_reallocate_string_storage(interp, result, 2 * dest_len);
+
+ p = (Parrot_UInt2 *)result->strstart;
+ u_strFromUTF8(p, dest_len, &dest_len, src->strstart, src->bufused, &err);
PARROT_ASSERT(U_SUCCESS(err));
}
+#else
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
+ "no ICU lib loaded");
+#endif
+ }
+ else {
+ UNIMPL;
}
- result->bufused = dest_len * sizeof (UChar);
- result->encoding = Parrot_utf16_encoding_ptr;
- result->strlen = src_len;
+
+ result->bufused = 2 * dest_len;
+ result->strlen = src_len;
/* downgrade if possible */
- if (dest_len == (int)src->strlen)
+ if (dest_len == src_len)
result->encoding = Parrot_ucs2_encoding_ptr;
+ else
+ result->encoding = Parrot_utf16_encoding_ptr;
+
return result;
-#else
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
- "no ICU lib loaded");
-#endif
}
/*
@@ -264,8 +262,7 @@
/*
-=item C<static UINTVAL utf16_ord(PARROT_INTERP, const STRING *src, UINTVAL
-offset)>
+=item C<static UINTVAL utf16_ord(PARROT_INTERP, const STRING *src, INTVAL idx)>
Returns the codepoint in string C<src> at position C<offset>.
@@ -274,21 +271,29 @@
*/
static UINTVAL
-utf16_ord(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset)
+utf16_ord(PARROT_INTERP, ARGIN(const STRING *src), INTVAL idx)
{
ASSERT_ARGS(utf16_ord)
#if PARROT_HAS_ICU
- const UChar * const s = (UChar*) src->strstart;
- UINTVAL c, pos;
- UNUSED(interp);
+ const UINTVAL len = STRING_length(src);
+ const UChar *s;
+ UINTVAL c, pos;
+
+ if (idx < 0)
+ idx += len;
+ if ((UINTVAL)idx >= len)
+ encoding_ord_error(interp, src, idx);
+
+ s = (UChar *)src->strstart;
pos = 0;
- U16_FWD_N_UNSAFE(s, pos, offset);
+ U16_FWD_N_UNSAFE(s, pos, idx);
U16_GET_UNSAFE(s, pos, c);
+
return c;
#else
UNUSED(src);
- UNUSED(offset);
+ UNUSED(idx);
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
"no ICU lib loaded");
@@ -297,8 +302,8 @@
/*
-=item C<static STRING * utf16_substr(PARROT_INTERP, const STRING *src, UINTVAL
-offset, UINTVAL count)>
+=item C<static STRING * utf16_substr(PARROT_INTERP, const STRING *src, INTVAL
+offset, INTVAL length)>
Returns the codepoints in string C<src> at position C<offset> and length
C<count>.
@@ -310,26 +315,55 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
static STRING *
-utf16_substr(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
+utf16_substr(PARROT_INTERP, ARGIN(const STRING *src), INTVAL offset, INTVAL length)
{
ASSERT_ARGS(utf16_substr)
#if PARROT_HAS_ICU
- UINTVAL pos = 0, start;
const UChar * const s = (UChar*) src->strstart;
- STRING * const return_string = Parrot_str_copy(interp, src);
+ const UINTVAL strlen = STRING_length(src);
+ STRING *return_string;
+ UINTVAL pos = 0, start;
+
+ if (offset < 0)
+ offset += strlen;
+
+ if ((UINTVAL)offset >= strlen || length <= 0) {
+ /* Allow regexes to return $' easily for "aaa" =~ /aaa/ */
+ if ((UINTVAL)offset == strlen || length <= 0)
+ return Parrot_str_new_noinit(interp, 0);
+
+ Parrot_ex_throw_from_c_args(interp, NULL,
+ EXCEPTION_SUBSTR_OUT_OF_STRING,
+ "Cannot take substr outside string");
+ }
+
+ return_string = Parrot_str_copy(interp, src);
+
+ if (offset == 0 && (UINTVAL)length >= strlen)
+ return return_string;
U16_FWD_N_UNSAFE(s, pos, offset);
+
start = pos * sizeof (UChar);
- return_string->strstart = (char *)return_string->strstart + start;
- U16_FWD_N_UNSAFE(s, pos, count);
- return_string->bufused = pos * sizeof (UChar) - start;
- return_string->strlen = count;
+ return_string->strstart += start;
+
+ if ((UINTVAL)length >= strlen - (UINTVAL)offset) {
+ return_string->bufused -= start;
+ return_string->strlen -= offset;
+ }
+ else {
+ U16_FWD_N_UNSAFE(s, pos, length);
+ return_string->bufused = pos * sizeof (UChar) - start;
+ return_string->strlen = length;
+ }
+
return_string->hashval = 0;
+
return return_string;
#else
UNUSED(src);
UNUSED(offset);
- UNUSED(count);
+ UNUSED(length);
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
"no ICU lib loaded");
Modified: branches/html_cleanup/src/string/encoding/utf8.c
==============================================================================
--- branches/html_cleanup/src/string/encoding/utf8.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/string/encoding/utf8.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -78,9 +78,7 @@
__attribute__nonnull__(3)
FUNC_MODIFIES(*i);
-static UINTVAL utf8_ord(PARROT_INTERP,
- ARGIN(const STRING *src),
- UINTVAL offset)
+static UINTVAL utf8_ord(PARROT_INTERP, ARGIN(const STRING *src), INTVAL idx)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -94,11 +92,11 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
-static const void * utf8_skip_backward(ARGIN(const void *ptr), UINTVAL n)
+static const utf8_t * utf8_skip_backward(ARGIN(const void *ptr), UINTVAL n)
__attribute__nonnull__(1);
PARROT_CANNOT_RETURN_NULL
-static const void * utf8_skip_forward(ARGIN(const void *ptr), UINTVAL n)
+static const utf8_t * utf8_skip_forward(ARGIN(const void *ptr), UINTVAL n)
__attribute__nonnull__(1);
PARROT_CAN_RETURN_NULL
@@ -304,8 +302,7 @@
/*
-=item C<static UINTVAL utf8_ord(PARROT_INTERP, const STRING *src, UINTVAL
-offset)>
+=item C<static UINTVAL utf8_ord(PARROT_INTERP, const STRING *src, INTVAL idx)>
Returns the codepoint in string C<src> at position C<offset>.
@@ -314,10 +311,20 @@
*/
static UINTVAL
-utf8_ord(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset)
+utf8_ord(PARROT_INTERP, ARGIN(const STRING *src), INTVAL idx)
{
ASSERT_ARGS(utf8_ord)
- const utf8_t * const start = (const utf8_t *)utf8_skip_forward(src->strstart, offset);
+ const UINTVAL len = STRING_length(src);
+ const utf8_t *start;
+
+ if (idx < 0)
+ idx += len;
+
+ if ((UINTVAL)idx >= len)
+ encoding_ord_error(interp, src, idx);
+
+ start = utf8_skip_forward(src->strstart, idx);
+
return utf8_decode(interp, start);
}
@@ -407,7 +414,7 @@
/*
-=item C<static const void * utf8_skip_forward(const void *ptr, UINTVAL n)>
+=item C<static const utf8_t * utf8_skip_forward(const void *ptr, UINTVAL n)>
Moves C<ptr> C<n> characters forward.
@@ -416,7 +423,7 @@
*/
PARROT_CANNOT_RETURN_NULL
-static const void *
+static const utf8_t *
utf8_skip_forward(ARGIN(const void *ptr), UINTVAL n)
{
ASSERT_ARGS(utf8_skip_forward)
@@ -432,7 +439,7 @@
/*
-=item C<static const void * utf8_skip_backward(const void *ptr, UINTVAL n)>
+=item C<static const utf8_t * utf8_skip_backward(const void *ptr, UINTVAL n)>
Moves C<ptr> C<n> characters back.
@@ -444,7 +451,7 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
-static const void *
+static const utf8_t *
utf8_skip_backward(ARGIN(const void *ptr), UINTVAL n)
{
ASSERT_ARGS(utf8_skip_backward)
@@ -479,10 +486,10 @@
const utf8_t *u8ptr = (utf8_t *)((char *)str->strstart + i->bytepos);
if (offset > 0) {
- u8ptr = (const utf8_t *)utf8_skip_forward(u8ptr, offset);
+ u8ptr = utf8_skip_forward(u8ptr, offset);
}
else if (offset < 0) {
- u8ptr = (const utf8_t *)utf8_skip_backward(u8ptr, -offset);
+ u8ptr = utf8_skip_backward(u8ptr, -offset);
}
return utf8_decode(interp, u8ptr);
@@ -508,10 +515,10 @@
const utf8_t *u8ptr = (utf8_t *)((char *)str->strstart + i->bytepos);
if (skip > 0) {
- u8ptr = (const utf8_t *)utf8_skip_forward(u8ptr, skip);
+ u8ptr = utf8_skip_forward(u8ptr, skip);
}
else if (skip < 0) {
- u8ptr = (const utf8_t *)utf8_skip_backward(u8ptr, -skip);
+ u8ptr = utf8_skip_backward(u8ptr, -skip);
}
i->charpos += skip;
@@ -629,22 +636,22 @@
if (pos < i->charpos) {
if (pos <= (i->charpos >> 1)) {
/* go forward from start */
- u8ptr = (const utf8_t *)utf8_skip_forward(u8ptr, pos);
+ u8ptr = utf8_skip_forward(u8ptr, pos);
}
else {
/* go backward from current */
- u8ptr = (const utf8_t *)utf8_skip_backward(u8ptr + i->bytepos, i->charpos - pos);
+ u8ptr = utf8_skip_backward(u8ptr + i->bytepos, i->charpos - pos);
}
}
else {
const UINTVAL len = str->strlen;
if (pos <= i->charpos + ((len - i->charpos) >> 1)) {
/* go forward from current */
- u8ptr = (const utf8_t *)utf8_skip_forward(u8ptr + i->bytepos, pos - i->charpos);
+ u8ptr = utf8_skip_forward(u8ptr + i->bytepos, pos - i->charpos);
}
else {
/* go backward from end */
- u8ptr = (const utf8_t *)utf8_skip_backward(u8ptr + str->bufused, len - pos);
+ u8ptr = utf8_skip_backward(u8ptr + str->bufused, len - pos);
}
}
Modified: branches/html_cleanup/src/sub.c
==============================================================================
--- branches/html_cleanup/src/sub.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/sub.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -234,8 +234,11 @@
base_pc = sub->seg->base.data;
current_annotation = pc - base_pc;
+ /* assert pc is in correct segment */
+ PARROT_ASSERT(base_pc <= pc && pc <= base_pc + sub->seg->base.size);
+
for (i = op = 0; op < debug_size; ++i) {
- op_info_t * const op_info = interp->code->op_info_table[*base_pc];
+ op_info_t * const op_info = sub->seg->op_info_table[*base_pc];
opcode_t var_args = 0;
if (i >= debug_size)
@@ -422,7 +425,7 @@
if (!PMC_IS_NULL(child_sub->outer_sub)) {
PMC_get_sub(interp, child_sub->outer_sub, child_outer_sub);
- if (Parrot_str_equal(interp, current_sub->subid,
+ if (STRING_equal(interp, current_sub->subid,
child_outer_sub->subid)) {
child_sub->outer_ctx = ctx;
}
Modified: branches/html_cleanup/src/warnings.c
==============================================================================
--- branches/html_cleanup/src/warnings.c Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/src/warnings.c Sun Oct 24 12:14:32 2010 (r49645)
@@ -74,7 +74,7 @@
Parrot_io_puts(interp, Parrot_io_STDERR(interp), "Unknown warning\n");
else {
Parrot_io_putps(interp, Parrot_io_STDERR(interp), msg);
- if (string_ord(interp, msg, -1) != '\n')
+ if (STRING_ord(interp, msg, -1) != '\n')
Parrot_io_eprintf(interp, "%c", '\n');
}
print_pbc_location(interp);
Copied: branches/html_cleanup/t/codingstd/c_enum.t (from r49644, trunk/t/codingstd/c_enum.t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/t/codingstd/c_enum.t Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/t/codingstd/c_enum.t)
@@ -0,0 +1,71 @@
+#! perl
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+use strict;
+use warnings;
+
+use lib qw[ . lib ../lib ../../lib ];
+use Test::More tests => 1;
+use Parrot::Distribution;
+
+=head1 NAME
+
+t/codingstd/c_enum.t - checks for rules related to enums in C source
+
+=head1 SYNOPSIS
+
+ # test all files
+ % prove t/codingstd/c_enum.t
+
+ # test specific files
+ % perl t/codingstd/c_enum.t src/foo.c include/parrot/bar.h
+
+
+=head1 DESCRIPTION
+
+Checks that all C language source files use enums appropriately (eg: C89-compliant).
+
+=cut
+
+my $DIST = Parrot::Distribution->new;
+my @files = @ARGV ? <@ARGV> : $DIST->get_c_language_files();
+
+check_enums(@files);
+
+exit;
+
+sub check_enums {
+ my @trailing_comma;
+
+ foreach my $file (@_) {
+ my $path = @ARGV ? $file : $file->path();
+ my $buf = $DIST->slurp($path);
+
+ # strip ', ", and C comments
+ $buf =~ s{ (?:
+ (?: (') (?: \\\\ | \\' | [^'] )* (') ) # remove ' string
+ | (?: (") (?: \\\\ | \\" | [^"] )* (") ) # remove " string
+ | /(\*) .*? (\*)/ # remove C comment
+ )
+ }{defined $1 ? "$1$2" : defined $3 ? "$3$4" : "$5$6"}egsx;
+
+ if ($buf =~ /enum \s+ (?: (\w+) \s+ )? {
+ [^}]+,
+ \s+ } (?: \s+ (\w+) )?/x) {
+ my $name = $1 || $2 || '(anonymous)';
+ push @trailing_comma => "$path: $name";
+ }
+ }
+
+ is( join("\n", @trailing_comma), "", <<END_DESCRIPTION );
+trailing commas in enums are not legal C89
+END_DESCRIPTION
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Modified: branches/html_cleanup/t/compilers/imcc/syn/objects.t
==============================================================================
--- branches/html_cleanup/t/compilers/imcc/syn/objects.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/compilers/imcc/syn/objects.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -28,7 +28,7 @@
.namespace ["Foo"]
.namespace [ ]
.namespace []
-.namespace [unicode:"»ö«"; ascii:"perl6"]
+.namespace [utf8:"»ö«"; ascii:"perl6"]
.sub test
$I0 = 42
Modified: branches/html_cleanup/t/compilers/imcc/syn/pcc.t
==============================================================================
--- branches/html_cleanup/t/compilers/imcc/syn/pcc.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/compilers/imcc/syn/pcc.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -545,13 +545,13 @@
.sub 'main' :main
$P0 = newclass 'Foo'
$P1 = new $P0
- $S0 = unicode:"foo\x{b1}"
+ $S0 = utf8:"foo\x{b1}"
$P1.$S0(1)
- $P1.unicode:"foo\x{b1}"(2)
+ $P1.utf8:"foo\x{b1}"(2)
.end
.namespace ['Foo']
-.sub unicode:"foo\x{b1}" :method
+.sub utf8:"foo\x{b1}" :method
.param int count
print 'ok '
print count
Modified: branches/html_cleanup/t/compilers/imcc/syn/regressions.t
==============================================================================
--- branches/html_cleanup/t/compilers/imcc/syn/regressions.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/compilers/imcc/syn/regressions.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -156,9 +156,9 @@
pir_output_is( <<'CODE', <<'OUT', 'unicode lexical identifiers (TT #575)');
.sub main :main
$P0 = box 'hello world'
- .lex unicode:"$\u03b2\u03bf\u03bf", $P0
+ .lex utf8:"$\u03b2\u03bf\u03bf", $P0
- $P1 = find_lex unicode:"$\u03b2\u03bf\u03bf"
+ $P1 = find_lex utf8:"$\u03b2\u03bf\u03bf"
say $P1
.end
CODE
@@ -167,12 +167,12 @@
pir_output_is( <<'CODE', <<'OUT', 'unicode named identifiers (TT #654)');
.sub 'main' :main
- 'foo'(1 :named(unicode:"\x{e4}"))
+ 'foo'(1 :named(utf8:"\x{e4}"))
.end
# Perl 6: sub foo(:$ä) { say "ok $ä"; }
.sub 'foo'
- .param int x :named(unicode:"\x{e4}")
+ .param int x :named(utf8:"\x{e4}")
print "ok "
say x
.end
Modified: branches/html_cleanup/t/compilers/imcc/syn/subflags.t
==============================================================================
--- branches/html_cleanup/t/compilers/imcc/syn/subflags.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/compilers/imcc/syn/subflags.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -97,7 +97,7 @@
## unicode nsentry
.const 'Sub' $P60 = 'subid3'
isa_ok($P60, 'Sub', 'subid3 found w/.const')
- $P0 = get_global unicode:"nsentry\u2462"
+ $P0 = get_global utf8:"nsentry\u2462"
$I0 = issame $P60, $P0
ok($I0, "nsentry3 found in namespace")
@@ -176,7 +176,7 @@
.end
-.sub 'anon3' :nsentry(unicode:"nsentry\u2462") :subid('subid3')
+.sub 'anon3' :nsentry(utf8:"nsentry\u2462") :subid('subid3')
.return ('anon3')
.end
Modified: branches/html_cleanup/t/configure/049-options_test_prepare.t
==============================================================================
--- branches/html_cleanup/t/configure/049-options_test_prepare.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/configure/049-options_test_prepare.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -10,9 +10,8 @@
use File::Basename qw( basename fileparse );
use File::Path qw( mkpath );
use File::Temp 0.13 qw| tempdir |;
-use Test::More tests => 10;
+use Test::More tests => 12;
use lib qw( lib );
-use IO::CaptureOutput qw| capture |;
use Parrot::Configure::Options::Test::Prepare ();
my $cwd = cwd();
@@ -75,24 +74,22 @@
auto::sometest
gen::sometest
);
- my $not_expected = q{gen::missing};
- push @tests_expected, $not_expected;
- my %tests_seen = ();
- {
- my ($stdout, $stderr);
- capture (
- sub { %tests_seen = map { $_, 1}
- Parrot::Configure::Options::Test::Prepare::_prepare_steps_tests_list(
- $tdir,
- $steps_tests_complex_ref,
- \@tests_expected,
- ) },
- \$stdout,
- \$stderr,
+ my @not_expected = ( q{gen::missing}, q{auto::fabulous} );
+ my @all_tests = ();
+ push @all_tests, (@tests_expected, @not_expected);
+ my ( $steps_tests_ref, $steps_lacking_tests_ref) =
+ Parrot::Configure::Options::Test::Prepare::_prepare_steps_tests_list(
+ $tdir,
+ $steps_tests_complex_ref,
+ \@all_tests,
);
- like($stderr, qr/No tests exist for configure step $not_expected/,
- "Warning about step class lacking test captured");
- }
+ is( scalar(@$steps_tests_ref), scalar(@tests_expected),
+ "Got expected number of existing steps" );
+ is( scalar(@$steps_lacking_tests_ref), scalar(@not_expected),
+ "Got expected number of missing steps" );
+ is( $steps_lacking_tests_ref->[0], $not_expected[0],
+ "Got expected missing step $not_expected[0]" );
+
ok( chdir $cwd, "Able to change back to starting directory");
}
Modified: branches/html_cleanup/t/library/string_utils.t
==============================================================================
--- branches/html_cleanup/t/library/string_utils.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/library/string_utils.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -68,8 +68,8 @@
test_radix_digits('[41,42]XYZ', 'x', 0, 'AB', 7, '\x[41,42]')
test_radix_digits('[41,42]' , 'x', 1, 'A' , 2, '\x41')
test_radix_digits('[41,42]' , 'x', 4, 'B', 2, '\x42')
- test_radix_digits('2000' , 'x', 0, unicode:"\u2000", 4, '\x2000')
- test_radix_digits('1680' , 'x', 0, unicode:"\u1680", 4, '\x1680')
+ test_radix_digits('2000' , 'x', 0, utf8:"\u2000", 4, '\x2000')
+ test_radix_digits('1680' , 'x', 0, utf8:"\u1680", 4, '\x1680')
.end
Modified: branches/html_cleanup/t/native_pbc/integer.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/html_cleanup/t/native_pbc/number.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/html_cleanup/t/native_pbc/string.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/html_cleanup/t/op/gc-non-recursive.t
==============================================================================
--- branches/html_cleanup/t/op/gc-non-recursive.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/op/gc-non-recursive.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -35,7 +35,7 @@
next = head
loop:
($I0, next) = next.'reify'()
- if $I1 < 10000000 goto loop
+ if $I0 < 500000 goto loop
sweep 1
ok(1, "Marking of large list doesn't exhaust C stack")
done_testing()
Modified: branches/html_cleanup/t/op/gc.t
==============================================================================
--- branches/html_cleanup/t/op/gc.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/op/gc.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -21,7 +21,7 @@
.sub main :main
.include 'test_more.pir'
- plan(140)
+ plan(139)
sweep_1()
sweep_0()
@@ -38,7 +38,6 @@
write_barrier_2()
addr_registry_1()
addr_registry_2_int()
- addr_registry_2_str()
pmc_proxy_obj_mark()
coro_context_ret_continuation()
# END_OF_TESTS
@@ -440,35 +439,6 @@
.end
-# AddrRegistry 2
-.sub addr_registry_2_str
- .local pmc a, b, c, reg, nil, it
- null nil
- reg = new 'AddrRegistry'
- a = new 'String'
- a = "k1"
- b = new 'String'
- b = "k2"
- c = new 'String'
- c = "k3"
- reg[a] = nil
- reg[b] = nil
- reg[c] = nil
-
- $P1 = new ['ResizablePMCArray']
- it = iter reg
-loop:
- unless it goto done
- $P0 = shift it
- $S0 = $P0
- push $P1, $S0
- goto loop
-done:
- $P1.'sort'()
- $S1 = join '', $P1
- is($S1, 'k1k2k3')
-.end
-
# verify pmc proxy object marking
.sub pmc_proxy_obj_mark
.local pmc cl, s, t
Modified: branches/html_cleanup/t/op/string.t
==============================================================================
--- branches/html_cleanup/t/op/string.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/op/string.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -318,7 +318,7 @@
.local int r
null s
eh = new ['ExceptionHandler']
- eh.'handle_types'(.EXCEPTION_SUBSTR_OUT_OF_STRING)
+ eh.'handle_types'(.EXCEPTION_UNEXPECTED_NULL)
set_addr eh, handler
push_eh eh
r = 1
@@ -650,7 +650,7 @@
ord $I0,$S0
ok( 0, 'no exception: 2-param ord, empty string register' )
handler:
- .exception_is( 'Cannot get character of NULL string' )
+ .exception_is( 'Invalid operation on null string' )
.end
.sub exception_three_param_ord_empty_string
@@ -666,7 +666,7 @@
ord $I0,$S0,0
ok( 0, 'no exception: 3-param ord, empty string register' )
handler:
- .exception_is( 'Cannot get character of NULL string' )
+ .exception_is( 'Invalid operation on null string' )
.end
.sub two_param_ord_one_character_string
@@ -875,15 +875,15 @@
# Ascii - Non-ascii, same content
set $S0, "hello"
- set $S1, unicode:"hello"
+ set $S1, utf8:"hello"
index $I1, $S0, $S1
is( $I1, "0", 'index, 3-arg form' )
index $I1, $S1, $S0
is( $I1, "0", 'index, 3-arg form' )
# Non-ascii, source shorter than searched
- set $S0, unicode:"-o"
- set $S1, unicode:"@INC"
+ set $S0, utf8:"-o"
+ set $S1, utf8:"@INC"
index $I1, $S0, $S1
is( $I1, "-1", 'index, 3-arg form' )
.end
@@ -903,7 +903,7 @@
# Ascii - Non-ascii, same content
set $S0, "hello"
- set $S1, unicode:"hello"
+ set $S1, utf8:"hello"
index $I1, $S0, $S1, 0
is( $I1, "0", 'index, 4-arg form' )
index $I1, $S1, $S0, 0
@@ -922,8 +922,8 @@
.end
.sub index_trac_1482
- $S0 = unicode:"bubuc"
- $S1 = unicode:"buc"
+ $S0 = utf8:"bubuc"
+ $S1 = utf8:"buc"
$I0 = index $S0, $S1, 0
is ($I0, 2, 'index, 4-arg, partial-match causes failure: TT #1482')
@@ -957,10 +957,19 @@
index $I1, $S0, $S1
is( $I1, "-1", 'index, null strings' )
+ .local pmc eh
+ eh = new ['ExceptionHandler']
+ eh.'handle_types'(.EXCEPTION_UNEXPECTED_NULL)
+ set_addr eh, handler
+ push_eh eh
+ $I1 = 1
null $S0
null $S1
- index $I1, $S0, $S1
- is( $I1, "-1", 'index, null strings' )
+ index $I0, $S0, $S1
+ $I1 = 0
+ handler:
+ pop_eh
+ is( $I1, "1", "index with null string throws" )
.end
.sub index_embedded_nulls
Modified: branches/html_cleanup/t/op/string_cclass.t
==============================================================================
--- branches/html_cleanup/t/op/string_cclass.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/op/string_cclass.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -309,7 +309,7 @@
sub string {
my $which = shift;
- 'unicode:"' . join( '', @{ $ws->{$which} } ) . '"';
+ 'utf8:"' . join( '', @{ $ws->{$which} } ) . '"';
}
my $all_ws = string('whitespace');
@@ -350,7 +350,7 @@
.local int result, char, len, i
.local string s
s = $all_ws
- s = unicode:"abc" . s
+ s = utf8:"abc" . s
len = length s
result = find_cclass .CCLASS_WHITESPACE, s, 0, len
print result
@@ -366,7 +366,7 @@
.local int result, char, len, i
.local string s
s = $all_ws
- s .= unicode:"abc"
+ s .= utf8:"abc"
len = length s
result = find_not_cclass .CCLASS_WHITESPACE, s, 0, len
print len
@@ -385,7 +385,7 @@
.include "cclass.pasm"
.local int result, char, len, i
.local string s
- s = unicode:"abc def"
+ s = utf8:"abc def"
len = length s
result = find_cclass .CCLASS_WHITESPACE, s, 0, len
print len
@@ -403,7 +403,7 @@
pir_output_is( <<'CODE', <<'OUT', "is_cclass, unicode first codepage" );
.include "cclass.pasm"
.sub main :main
- $S1 = unicode:"ab\nC_X34.\0 \t!"
+ $S1 = utf8:"ab\nC_X34.\0 \t!"
test1( $S1 )
.end
.sub test1
Modified: branches/html_cleanup/t/op/string_cs.t
==============================================================================
--- branches/html_cleanup/t/op/string_cs.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/op/string_cs.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -473,7 +473,6 @@
CODE
hello(5): ascii
hello(5): utf8
-hello(5): utf8
hello(10): utf16
hello(10): ucs2
OUTPUT
@@ -506,7 +505,6 @@
CODE
(0): ascii
(0): utf8
-(0): utf8
(0): utf16
(0): ucs2
OUTPUT
Modified: branches/html_cleanup/t/op/stringu.t
==============================================================================
--- branches/html_cleanup/t/op/stringu.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/op/stringu.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -44,7 +44,7 @@
$P0 = getinterp
$P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
$P1.'encoding'("utf8")
- set $S0, unicode:"\x{212b}"
+ set $S0, utf8:"\x{212b}"
print $S0
print "\n"
end
@@ -59,7 +59,7 @@
$P0 = getinterp
$P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
$P1.'encoding'("utf8")
- set $S0, unicode:"aaaaaa\x{212b}"
+ set $S0, utf8:"aaaaaa\x{212b}"
print $S0
print "\n"
end
@@ -74,7 +74,7 @@
$P0 = getinterp
$P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
$P1.'encoding'("utf8")
- set $S0, unicode:"aaaaaa\x{212b}-aaaaaa"
+ set $S0, utf8:"aaaaaa\x{212b}-aaaaaa"
print $S0
print "\n"
end
@@ -89,7 +89,7 @@
$P0 = getinterp
$P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
$P1.'encoding'("utf8")
- set $S0, unicode:"aaaaaa\u212b-aaaaaa"
+ set $S0, utf8:"aaaaaa\u212b-aaaaaa"
print $S0
print "\n"
end
@@ -104,7 +104,7 @@
$P0 = getinterp
$P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
$P1.'encoding'("utf8")
- set $S0, unicode:"aaaaaa\x{1d400}-aaaaaa"
+ set $S0, utf8:"aaaaaa\x{1d400}-aaaaaa"
print $S0
print "\n"
end
@@ -119,7 +119,7 @@
$P0 = getinterp
$P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
$P1.'encoding'("utf8")
- set $S0, unicode:"aaaaaa\U0001d400-aaaaaa"
+ set $S0, utf8:"aaaaaa\U0001d400-aaaaaa"
print $S0
print "\n"
end
@@ -134,7 +134,7 @@
$P0 = getinterp
$P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
$P1.'encoding'("utf8")
- set $S0, unicode:"aaaaaa\x{212b}-bbbbbb\x{1d400}-cccccc"
+ set $S0, utf8:"aaaaaa\x{212b}-bbbbbb\x{1d400}-cccccc"
print $S0
print "\n"
length $I0, $S0
@@ -153,7 +153,7 @@
$P0 = getinterp
$P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
$P1.'encoding'("utf8")
- set $S0, unicode:"aaaaaa\x{1d400}-bbbbbb\x{212b}-cccccc"
+ set $S0, utf8:"aaaaaa\x{1d400}-bbbbbb\x{212b}-cccccc"
print $S0
print "\n"
length $I0, $S0
@@ -225,7 +225,7 @@
OUTPUT
pasm_output_is( <<'CODE', <<OUTPUT, "UTF8 literals" );
- set S0, utf8:unicode:"«"
+ set S0, utf8:"«"
length I0, S0
print I0
print "\n"
@@ -291,12 +291,12 @@
.local string str
.local string rest
- str = unicode:".xyz"
+ str = utf8:".xyz"
rest = substr str, 1
print rest
print "\n"
- str = unicode:".xyz"
+ str = utf8:".xyz"
$S99 = downcase str
rest = substr str, 1
print rest
@@ -312,7 +312,7 @@
.sub main
.local string str
.local string rest
- str = unicode:".XYZ"
+ str = utf8:".XYZ"
$S0 = downcase str
print $S0
print "\n"
@@ -344,7 +344,7 @@
.sub main
.include 'cclass.pasm'
.local string s
- s = unicode:" \t\u207babc\n\u2000\u2009"
+ s = utf8:" \t\u207babc\n\u2000\u2009"
$I9 = length s
$I0 = is_cclass .CCLASS_WHITESPACE, s, 0
print $I0
@@ -371,7 +371,7 @@
.sub main
.include 'cclass.pasm'
.local string s
- s = unicode:" \t\u207babc\n\u2000\u2009"
+ s = utf8:" \t\u207babc\n\u2000\u2009"
$I9 = length s
$I0 = is_cclass .CCLASS_ANY, s, 0
print $I0
@@ -403,7 +403,7 @@
.sub main
.include 'cclass.pasm'
.local string s
- s = unicode:"01\u207bxyz\u0660\u17e1\u19d9"
+ s = utf8:"01\u207bxyz\u0660\u17e1\u19d9"
$I9 = length s
$I0 = is_cclass .CCLASS_NUMERIC, s, 0
print $I0
@@ -425,23 +425,23 @@
1102269
OUTPUT
- # Concatenate unicode: with iso-8859-1
+ # Concatenate utf8: with iso-8859-1
pir_output_is(
<<'CODE', <<"OUTPUT", "Concat unicode with iso-8859-1" );
.sub main
- $S0 = unicode:"A"
+ $S0 = utf8:"A"
$S1 = ascii:"B"
$S2 = concat $S0, $S1
print $S2
print "\n"
- $S0 = unicode:"A"
- $S1 = unicode:"B"
+ $S0 = utf8:"A"
+ $S1 = utf8:"B"
$S2 = concat $S0, $S1
print $S2
print "\n"
- $S0 = unicode:"A"
+ $S0 = utf8:"A"
$S1 = iso-8859-1:"B"
$S2 = concat $S0, $S1
print $S2
@@ -457,7 +457,7 @@
pir_output_is( <<'CODE', <<OUTPUT, "UTF-8 and Unicode hash keys");
.sub 'main'
.local string str0, str1
- str0 = unicode:"\u00ab"
+ str0 = utf8:"\u00ab"
str1 = iso-8859-1:"\xab"
.local pmc hash
@@ -484,7 +484,7 @@
pir_output_is( <<'CODE', <<OUTPUT, "UTF-8 and Unicode hash keys, full bucket" );
.sub 'main'
.local string str0, str1
- str0 = unicode:"infix:\u00b1"
+ str0 = utf8:"infix:\u00b1"
str1 = iso-8859-1:"infix:\xb1"
.local pmc hash
@@ -555,7 +555,7 @@
pir_output_is( <<'CODE', <<'OUT', 'numification of unicode strings float mixed' );
.sub main :main
- $S0 = unicode:"140 r\x{e9}sum\x{e9}s"
+ $S0 = utf8:"140 r\x{e9}sum\x{e9}s"
$N0 = $S0
say $N0
$I0 = find_encoding 'ucs2'
@@ -575,14 +575,14 @@
$S1 = chr 0xe5
$S2 = chr 0x263b
- $S0 = unicode:"\u00e5\u263b"
+ $S0 = utf8:"\u00e5\u263b"
$S3 = concat $S1, $S2
if $S0 == $S3 goto equal_1
print "not "
equal_1:
say "equal"
- $S0 = unicode:"\u263b\u00e5"
+ $S0 = utf8:"\u263b\u00e5"
$S3 = concat $S2, $S1
if $S0 == $S3 goto equal_2
print "not "
@@ -598,7 +598,7 @@
.sub 'main'
new $P0, 'ResizablePMCArray'
push $P0, ascii:"a"
- push $P0, unicode:"\x{e1}" # a acute
+ push $P0, utf8:"\x{e1}" # a acute
push $P0, iso-8859-1:"\x{e1}" # a acute
join $S0, "", $P0
$I0 = length $S0
Modified: branches/html_cleanup/t/op/testlib/test_strings.pir
==============================================================================
--- branches/html_cleanup/t/op/testlib/test_strings.pir Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/op/testlib/test_strings.pir Sun Oct 24 12:14:32 2010 (r49645)
@@ -4,20 +4,18 @@
.sub 'get_hellos'
$P0 = new ['ResizableStringArray']
push $P0, "hello"
- push $P0, unicode:"hello"
- push $P0, utf8:unicode:"hello"
- push $P0, utf16:unicode:"hello"
- push $P0, ucs2:unicode:"hello"
+ push $P0, utf8:"hello"
+ push $P0, utf16:"hello"
+ push $P0, ucs2:"hello"
.return ($P0)
.end
.sub 'get_empties'
$P0 = new ['ResizableStringArray']
push $P0, ""
- push $P0, unicode:""
- push $P0, utf8:unicode:""
- push $P0, utf16:unicode:""
- push $P0, ucs2:unicode:""
+ push $P0, utf8:""
+ push $P0, utf16:""
+ push $P0, ucs2:""
.return ($P0)
.end
Modified: branches/html_cleanup/t/pmc/boolean.t
==============================================================================
--- branches/html_cleanup/t/pmc/boolean.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/boolean.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -17,9 +17,11 @@
=cut
+.include 'fp_equality.pasm'
+
.sub main :main
.include 'test_more.pir'
- plan(31)
+ plan(33)
init_null_tests()
init_int_tests()
instantiate_tests()
@@ -82,6 +84,17 @@
set $P0, $N0
set $I0, $P0
is($I0, 1, "Boolean converts non-0 num to true")
+
+ $P0 = 1
+ $N1 = $P0
+
+ .fp_eq_ok($N1, 1, 'Boolean converts true value to a numeric')
+
+ $P0 = 0
+ $N1 = $P0
+
+ .fp_eq_ok($N1, 0, 'Boolean converts false value to a numeric')
+
.end
.sub string_tests
Modified: branches/html_cleanup/t/pmc/bytebuffer.t
==============================================================================
--- branches/html_cleanup/t/pmc/bytebuffer.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/bytebuffer.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -22,7 +22,7 @@
.sub 'main' :main
.include 'test_more.pir'
- plan(37)
+ plan(38)
test_init()
test_set_string()
@@ -65,6 +65,14 @@
n = elements bb
is(n, 42, "size of a new buffer with initial size is correct")
+ push_eh handler
+ bb = new ['ByteBuffer'], -1
+handler:
+ pop_eh
+ ok(1,"Creating a negative-sized ByteBuffer throws an exception")
+ goto done
+
+ done:
.end
.sub test_set_string
@@ -150,7 +158,7 @@
bb = new ['ByteBuffer']
# Upper case n tilde: codepoint 0xD1, utf8 encoding 0xC3, 0x91
- #bb = utf16:unicode:"\x{D1}"
+ #bb = utf16:"\x{D1}"
# Can't do that, or the program can't be compiled without ICU.
# Fill the buffer with bytes instead.
@@ -173,7 +181,7 @@
bb = new ['ByteBuffer']
bb[0] = 0xC3
bb[1] = 0x91
- s = bb.'get_string_as'(utf8:unicode:"")
+ s = bb.'get_string_as'(utf8:"")
n = length s
is(n, 1, "getting utf8 from buffer gives correct length")
n = ord s
Modified: branches/html_cleanup/t/pmc/fixedpmcarray.t
==============================================================================
--- branches/html_cleanup/t/pmc/fixedpmcarray.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/fixedpmcarray.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -69,7 +69,6 @@
.sub test_sort
.local pmc compares, cmp_fun
- # TT #1317 doesnt work wit prederef of JIT
bounds 1
compares = new ['Integer']
compares = 0
Modified: branches/html_cleanup/t/pmc/hash.t
==============================================================================
--- branches/html_cleanup/t/pmc/hash.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/hash.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -1311,7 +1311,7 @@
.sub unicode_keys_register_rt_39249
$P1 = new ['Hash']
- $S99 = unicode:"\u7777"
+ $S99 = utf8:"\u7777"
$P1[$S99] = "ok"
$S1 = $P1[$S99]
is( $S1, 'ok', 'unicode key' )
@@ -1320,11 +1320,11 @@
.sub unicode_keys_literal_rt_39249
$P1 = new ['Hash']
- $P1[unicode:"\u7777"] = "ok"
- $S1 = $P1[unicode:"\u7777"]
+ $P1[utf8:"\u7777"] = "ok"
+ $S1 = $P1[utf8:"\u7777"]
is( $S1, 'ok', 'literal unicode key' )
- $S2 = unicode:"\u7777"
+ $S2 = utf8:"\u7777"
$S1 = $P1[$S2]
is( $S1, 'ok', 'literal unicode key lookup via var' )
.end
Modified: branches/html_cleanup/t/pmc/lexpad.t
==============================================================================
--- branches/html_cleanup/t/pmc/lexpad.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/lexpad.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -19,10 +19,11 @@
.sub main :main
.include 'test_more.pir'
- plan(8)
+ plan(9)
new_test()
test_keyed()
+ test_keyed_empty()
test_iter()
.end
@@ -63,6 +64,15 @@
end:
.end
+.sub test_keyed_empty
+ .local pmc info, pad, lex
+ info = new ['LexInfo']
+ pad = new ['LexPad'], info
+ lex = pad['nosuchlex']
+ $I0 = isnull lex
+ ok($I0, 'get an item from empty lexpad gives null')
+.end
+
.sub 'test_iter'
.local pmc str1,str2,str3
Modified: branches/html_cleanup/t/pmc/multidispatch.t
==============================================================================
--- branches/html_cleanup/t/pmc/multidispatch.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/multidispatch.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -1145,20 +1145,20 @@
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "unicode sub names and multi" );
-.sub unicode:"\u7777" :multi(string)
+.sub utf8:"\u7777" :multi(string)
.param pmc arg
print 'String:'
say arg
.end
-.sub unicode:"\u7777" :multi(int)
+.sub utf8:"\u7777" :multi(int)
.param pmc arg
print 'Int:'
say arg
.end
.sub main :main
- unicode:"\u7777"('what')
- unicode:"\u7777"(23)
+ utf8:"\u7777"('what')
+ utf8:"\u7777"(23)
.end
CODE
String:what
Modified: branches/html_cleanup/t/pmc/namespace.t
==============================================================================
--- branches/html_cleanup/t/pmc/namespace.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/namespace.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -278,7 +278,7 @@
test8:
push_eh eh8
- $P0 = get_global [ unicode:"Fran\x{00E7}ois" ], "baz"
+ $P0 = get_global [ utf8:"Fran\x{00E7}ois" ], "baz"
$I0 = isnull $P0
is($I0, 0, "Find Sub in an ISO-8859-1 NameSpace looked up by a Unicode name")
$S0 = $P0()
@@ -291,9 +291,9 @@
test9:
push_eh eh9
- $P0 = get_global [ unicode:"\x{20AC}uros" ], "baz"
+ $P0 = get_global [ utf8:"\x{20AC}uros" ], "baz"
$S0 = $P0()
- is($S0, unicode:"\x{20AC}uros", "Found sub in Unicode NameSpace")
+ is($S0, utf8:"\x{20AC}uros", "Found sub in Unicode NameSpace")
goto end_test9
eh9:
ok(0, "Cannot find sub in Unicode NameSpace")
@@ -302,9 +302,9 @@
test10:
push_eh eh10
- $P0 = get_global [ "Foo";unicode:"\x{20AC}uros" ], "baz"
+ $P0 = get_global [ "Foo";utf8:"\x{20AC}uros" ], "baz"
$S0 = $P0()
- is($S0, unicode:"Foo::\x{20AC}uros", "Found sub in nested Unicode NameSpace")
+ is($S0, utf8:"Foo::\x{20AC}uros", "Found sub in nested Unicode NameSpace")
goto end_test10
eh10:
ok(0, "Cannot find sub in nested Unicode NameSpace")
@@ -685,15 +685,15 @@
.end
# Namesace specified in Unicode
-.namespace [ unicode:"\x{20AC}uros" ]
+.namespace [ utf8:"\x{20AC}uros" ]
.sub 'baz'
- .return(unicode:"\x{20AC}uros")
+ .return(utf8:"\x{20AC}uros")
.end
# Nested namespace specified in Unicode
-.namespace [ "Foo";unicode:"\x{20AC}uros" ]
+.namespace [ "Foo";utf8:"\x{20AC}uros" ]
.sub 'baz'
- .return(unicode:"Foo::\x{20AC}uros")
+ .return(utf8:"Foo::\x{20AC}uros")
.end
.HLL "MyHLL"
Modified: branches/html_cleanup/t/pmc/sockaddr.t
==============================================================================
--- branches/html_cleanup/t/pmc/sockaddr.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/sockaddr.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -19,8 +19,13 @@
.sub main :main
.include 'test_more.pir'
- plan(5)
+ plan(6)
+ test_basic()
+ test_bool()
+.end
+
+.sub test_basic
new $P0, ['Socket']
ok(1, 'Instantiated a Socket PMC')
@@ -39,6 +44,18 @@
is($S2, 'Sockaddr', 'PMC clone has correct type')
.end
+.sub test_bool
+ $P0 = new 'Socket'
+ $P1 = $P0."sockaddr"("localhost", 1234)
+ push_eh handler
+ ok($P1, 'get_bool on a SockAddr')
+ goto done
+handler:
+ pop_eh
+ todo(0,'get_bool on SockAddr does not work TT#1822')
+done:
+.end
+
# Local Variables:
# mode: pir
# fill-column: 100
Modified: branches/html_cleanup/t/pmc/socket.t
==============================================================================
--- branches/html_cleanup/t/pmc/socket.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/socket.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -1,5 +1,5 @@
#!./parrot
-# Copyright (C) 2006-2009, Parrot Foundation.
+# Copyright (C) 2006-2010, Parrot Foundation.
# $Id$
=head1 NAME
@@ -16,13 +16,118 @@
=cut
+.include 'socket.pasm'
.sub main :main
.include 'test_more.pir'
- plan(1)
+ plan(15)
+ test_init()
+ test_clone()
+ test_bool()
+ test_close()
+ test_tcp_socket()
+ test_tcp_socket6()
+ test_raw_tcp_socket()
+ test_raw_tcp_socket6()
+ test_udp_socket()
+ test_udp_socket6()
+ test_raw_udp_socket()
+ test_raw_udp_socket6()
+
+.end
+
+.sub test_init
new $P0, ['Socket']
ok(1, 'Instantiated a Socket PMC')
+
+ $S0 = typeof $P0
+ is($S0, 'Socket', 'PMC has correct type')
+.end
+
+.sub test_bool
+ new $P0, ['Socket']
+ ok($P0, 'get_bool on Socket')
+.end
+
+.sub test_close
+ new $P0, ['Socket']
+ $P0.'close'()
+ ok(1, 'Closed a Socket')
+ nok($P0,'A closed Socket returns False')
+.end
+
+.sub test_clone
+ new $P0, ['Socket']
+ $P1 = $P0."sockaddr"("localhost", 1234)
+
+ $P2 = clone $P1
+ ok(1, 'Cloned a Socket PMC')
+
+ $S0 = typeof $P2
+ $S1 = 'Socket'
+ $I0 = iseq $S0, $S1
+ todo($I0, 'Cloned PMC has correct type TT#1820')
+.end
+
+.sub test_tcp_socket
+ .local pmc sock
+ sock = new 'Socket'
+ sock.'socket'(.PIO_PF_INET, .PIO_SOCK_STREAM, .PIO_PROTO_TCP)
+ ok(sock, 'Created a TCP Socket')
+.end
+
+.sub test_tcp_socket6
+ .local pmc sock
+ sock = new 'Socket'
+ sock.'socket'(.PIO_PF_INET6, .PIO_SOCK_STREAM, .PIO_PROTO_TCP)
+ ok(sock, 'Created a IPv6 TCP Socket')
+.end
+
+.sub test_raw_tcp_socket6
+ .local pmc sock
+ sock = new 'Socket'
+ sock.'socket'(.PIO_PF_INET6, .PIO_SOCK_RAW, .PIO_PROTO_TCP)
+ ok(sock, 'Created a raw IPv6 TCP Socket')
+.end
+
+.sub test_udp_socket6
+ .local pmc sock
+ sock = new 'Socket'
+
+ sock.'socket'(.PIO_PF_INET6, .PIO_SOCK_STREAM, .PIO_PROTO_UDP)
+ ok(sock, 'Created a IPv6 UDP Socket')
+.end
+
+.sub test_raw_udp_socket6
+ .local pmc sock
+ sock = new 'Socket'
+
+ sock.'socket'(.PIO_PF_INET6, .PIO_SOCK_RAW, .PIO_PROTO_UDP)
+ ok(sock, 'Created a raw IPv6 UDP Socket')
+.end
+
+.sub test_raw_tcp_socket
+ .local pmc sock
+ sock = new 'Socket'
+ sock.'socket'(.PIO_PF_INET, .PIO_SOCK_RAW, .PIO_PROTO_TCP)
+ ok(sock, 'Created a raw TCP Socket')
+.end
+
+.sub test_udp_socket
+ .local pmc sock
+ sock = new 'Socket'
+
+ sock.'socket'(.PIO_PF_INET, .PIO_SOCK_STREAM, .PIO_PROTO_UDP)
+ ok(sock, 'Created a UDP Socket')
+.end
+
+.sub test_raw_udp_socket
+ .local pmc sock
+ sock = new 'Socket'
+
+ sock.'socket'(.PIO_PF_INET, .PIO_SOCK_RAW, .PIO_PROTO_UDP)
+ ok(sock, 'Created a raw UDP Socket')
.end
# Local Variables:
Modified: branches/html_cleanup/t/pmc/string.t
==============================================================================
--- branches/html_cleanup/t/pmc/string.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/string.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -19,7 +19,7 @@
.sub main :main
.include 'test_more.pir'
- plan(121)
+ plan(124)
set_or_get_strings()
setting_integers()
@@ -45,6 +45,7 @@
test_string_replace()
set_i0__p0__string_to_int()
test_string_trans()
+ reverse_string()
is_integer__check_integer()
instantiate_str()
get_string_returns_cow_string()
@@ -566,6 +567,21 @@
.return(tr_array)
.end
+.sub reverse_string
+ $P0 = box 'torrap'
+ $P0.'reverse'()
+ is( $P0, "parrot", 'reverse string' )
+
+ $P0 = box 'x'
+ $P0.'reverse'('hsifyllej')
+ is( $P0, 'jellyfish', "reverse string with optional arg")
+
+ $P0 = box unicode:"科ムウオ"
+ $P0.'reverse'()
+ is( $P0, unicode:"オウム科", 'reverse unicode string')
+
+.end
+
.sub is_integer__check_integer
$P0 = new ['String']
Modified: branches/html_cleanup/t/pmc/stringbuilder.t
==============================================================================
--- branches/html_cleanup/t/pmc/stringbuilder.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/stringbuilder.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -124,7 +124,7 @@
s = repeat iso-8859-1:"x", n
push sb, s
# push a string that needs reallocation and has incompatible encoding rep.
- s = unicode:"yyyy"
+ s = utf8:"yyyy"
push sb, s
# Check the expected string length. Not a rock solid check, but the
# purpose of this test is just code coverage, so is enough.
@@ -158,7 +158,7 @@
sb = new ["StringBuilder"]
push sb, "le"
- push sb, unicode:"o "
+ push sb, utf8:"o "
push sb, iso-8859-1:"tötsch"
$S0 = sb
@@ -311,7 +311,7 @@
iterator = iter list
.local pmc sb
sb = new 'StringBuilder'
- sb = unicode:""
+ sb = utf8:""
loop:
unless iterator goto done
$P1 = shift iterator
@@ -359,11 +359,11 @@
push sb, "foo"
push sb, iso-8859-1:"\x{E4}\x{F6}\x{FC}"
- push sb, utf8:unicode:"БДЖ"
+ push sb, utf8:"БДЖ"
push sb, "bar"
$S0 = sb
- is( $S0, utf8:unicode:"fooäöüБДЖbar", 'push strings with different encodings' )
+ is( $S0, utf8:"fooäöüБДЖbar", 'push strings with different encodings' )
.end
# Local Variables:
Modified: branches/html_cleanup/t/pmc/sub.t
==============================================================================
--- branches/html_cleanup/t/pmc/sub.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/pmc/sub.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -1157,7 +1157,7 @@
# see also #38964
pir_output_is( <<'CODE', <<'OUTPUT', 'unicode sub names, compilation' );
-.sub unicode:"\u7777"
+.sub utf8:"\u7777"
print "ok\n"
.end
CODE
@@ -1165,24 +1165,24 @@
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', 'unicode sub names, invocation' );
-.sub unicode:"\u7777"
+.sub utf8:"\u7777"
print "ok\n"
.end
.sub test :main
- unicode:"\u7777"()
+ utf8:"\u7777"()
.end
CODE
ok
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', 'unicode sub names, dynamic' );
-.sub unicode:"\u7777"
+.sub utf8:"\u7777"
print "ok\n"
.end
.sub test :main
- $P1 = find_name unicode:"\u7777"
+ $P1 = find_name utf8:"\u7777"
$P1()
.end
CODE
@@ -1190,12 +1190,12 @@
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', 'unicode sub names' );
-.sub unicode:"\u7777"
+.sub utf8:"\u7777"
print "ok\n"
.end
.sub test :main
- # unicode:"\u7777" ends up as a string nicode:"\u7777
+ # utf8:"\u7777" ends up as a string nicode:"\u7777
# (or it did, in r12860)
$P1 = find_name 'nicode:"\u7777'
unless null $P1 goto bad
@@ -1208,11 +1208,11 @@
pir_output_is( <<'CODE', <<'OUTPUT', 'unicode sub constant' );
.sub main :main
- .const 'Sub' s = unicode:"\u7777"
+ .const 'Sub' s = utf8:"\u7777"
s()
.end
-.sub unicode:"\u7777"
+.sub utf8:"\u7777"
print "ok\n"
.end
CODE
Modified: branches/html_cleanup/t/profiling/profiling.t
==============================================================================
--- branches/html_cleanup/t/profiling/profiling.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/profiling/profiling.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -5,10 +5,10 @@
INIT {
pir::load_bytecode('ProfTest.pbc');
+ Q:PIR{ .include "test_more.pir" };
}
-
-plan(12);
+plan(13);
my $pir_code :=
'.sub main
@@ -161,6 +161,43 @@
ok( $matcher.matches($prof), "profile shows say on the correct line");
+my $uncaught_c_ex := '
+.sub main :main
+ .local string s
+ s = <<"CODE"
+ .sub main
+ $P0 = new ["FixedPMCArray"], -10 #throw a C-level exception
+ .end
+CODE
+
+ .local pmc f, comp
+ comp = compreg "PIR"
+
+ .local pmc eh
+ eh = new ["ExceptionHandler"]
+ set_addr eh, handler
+ push_eh eh
+
+ f = comp(s)
+ f()
+
+ pop_eh
+ goto done
+
+ handler:
+ pop_eh
+ done:
+.end';
+
+my $uncaught_c_ex_prof := ProfTest::PIRProfile.new($uncaught_c_ex);
+
+my $uncaught_c_ex_matcher := ProfTest::Matcher.new(
+ eor(),
+);
+
+ok( $uncaught_c_ex_matcher.matches($uncaught_c_ex_prof),
+ "pir with uncaught C exception in eval'd code shows END_OF_RUNLOOP");
+
my $nqp_code :=
'main();
Modified: branches/html_cleanup/t/steps/auto/format-01.t
==============================================================================
--- branches/html_cleanup/t/steps/auto/format-01.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/steps/auto/format-01.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -5,7 +5,7 @@
use strict;
use warnings;
-use Test::More tests => 17;
+use Test::More tests => 18;
use Carp;
use lib qw( lib t/configure/testlib );
use_ok('config::init::defaults');
@@ -33,6 +33,7 @@
$conf->add_steps($pkg);
$conf->options->set(%{$args});
$step = test_step_constructor_and_description($conf);
+ok($step->runstep($conf), 'runstep() returned true value');
{
$conf->data->set( iv => 'int' );
auto::format::_set_intvalfmt($conf);
Copied: branches/html_cleanup/t/steps/auto/ipv6-01.t (from r49644, trunk/t/steps/auto/ipv6-01.t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/t/steps/auto/ipv6-01.t Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/t/steps/auto/ipv6-01.t)
@@ -0,0 +1,92 @@
+#! perl
+# Copyright (C) 2007, Parrot Foundation.
+# $Id$
+# auto/ipv6-01.t
+
+use strict;
+use warnings;
+use Test::More qw(no_plan); # tests => 5;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::auto::ipv6');
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
+use Parrot::Configure::Test qw(
+ test_step_constructor_and_description
+);
+
+my ($args, $step_list_ref) = process_options(
+ {
+ argv => [ ],
+ mode => q{configure},
+ }
+);
+
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
+
+my $pkg = q{auto::ipv6};
+$conf->add_steps($pkg);
+$conf->options->set( %{$args} );
+my $step = test_step_constructor_and_description($conf);
+my $ret = $step->runstep($conf);
+ok( $ret, "runstep() returned true value" );
+
+##### _handle_ipv6_status #####
+
+my ($ipv6_status, $exp);
+
+$conf->data->set( HAS_IPV6 => undef );
+$ipv6_status = 1;
+$exp = 'yes';
+$step->_handle_ipv6_status($conf, $ipv6_status);
+ok( defined $conf->data->get( 'HAS_IPV6' ),
+ "HAS_IPV6 is defined" );
+ok( $conf->data->get( 'HAS_IPV6' ),
+ "HAS_IPV6 is true value" );
+is( $step->result(), $exp, "Got expected result '$exp'" );
+
+$conf->data->set( HAS_IPV6 => undef );
+$ipv6_status = 0;
+$exp = 'no';
+$step->_handle_ipv6_status($conf, $ipv6_status);
+ok( defined $conf->data->get( 'HAS_IPV6' ),
+ "HAS_IPV6 is defined" );
+ok( ! $conf->data->get( 'HAS_IPV6' ),
+ "HAS_IPV6 is false value" );
+is( $step->result(), $exp, "Got expected result '$exp'" );
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+auto/ipv6-01.t - test auto::ipv6
+
+=head1 SYNOPSIS
+
+ % prove t/steps/auto/ipv6-01.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test auto::ipv6.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::ipv6, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Modified: branches/html_cleanup/t/steps/auto/llvm-01.t
==============================================================================
--- branches/html_cleanup/t/steps/auto/llvm-01.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/steps/auto/llvm-01.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -6,17 +6,14 @@
use strict;
use warnings;
use File::Temp qw( tempdir );
-use Test::More tests => 69;
+use Test::More tests => 56;
use Carp;
use lib qw( lib t/configure/testlib );
-use_ok('config::init::defaults');
-use_ok('config::inter::progs');
use_ok('config::auto::llvm');
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
use Parrot::Configure::Test qw(
- test_step_thru_runstep
- rerun_defaults_for_testing
test_step_constructor_and_description
);
use IO::CaptureOutput qw( capture );
@@ -28,13 +25,11 @@
mode => q{configure},
} );
-my $conf = Parrot::Configure->new;
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
my $serialized = $conf->pcfreeze();
-test_step_thru_runstep($conf, q{init::defaults}, $args);
-test_step_thru_runstep($conf, q{inter::progs}, $args);
-
my $pkg = q{auto::llvm};
$conf->add_steps($pkg);
@@ -53,7 +48,7 @@
argv => [ q{--verbose} ],
mode => q{configure},
} );
-rerun_defaults_for_testing($conf, $args );
+
$conf->add_steps($pkg);
$conf->options->set( %{$args} );
$step = test_step_constructor_and_description($conf);
Copied: branches/html_cleanup/t/steps/auto/stat-01.t (from r49644, trunk/t/steps/auto/stat-01.t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/t/steps/auto/stat-01.t Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/t/steps/auto/stat-01.t)
@@ -0,0 +1,82 @@
+#!perl
+# Copyright (C) 2001-2007, Parrot Foundation.
+# $Id$
+# auto/stat-01.t
+
+use strict;
+use warnings;
+use Test::More tests => 10;
+use lib qw( lib t/configure/testlib );
+use_ok('config::auto::stat');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
+use Parrot::Configure::Test qw(
+ test_step_constructor_and_description
+);
+
+########## regular ##########
+
+my ($args, $step_list_ref) = process_options( {
+ argv => [ ],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
+
+my $pkg = q{auto::stat};
+
+$conf->add_steps($pkg);
+$conf->options->set( %{$args} );
+my $step = test_step_constructor_and_description($conf);
+ok($step->runstep($conf), "${pkg}::runstep() returned true value");
+
+##### _handle_bsd_stat #####
+
+my ($bsd_stat, $exp);
+
+$bsd_stat = 1;
+$step->_handle_bsd_stat($conf, $bsd_stat);
+is($conf->data->get('HAS_BSD_STAT_EXTN'), 1,
+ "Got expected value for HAS_BSD_STAT_EXTN");
+$exp = 'bsd';
+is($step->result(), $exp,
+ "Got expected result '$exp'");
+
+$bsd_stat = 0;
+$step->_handle_bsd_stat($conf, $bsd_stat);
+is($conf->data->get('HAS_BSD_STAT_EXTN'), 0,
+ "Got expected value for HAS_BSD_STAT_EXTN");
+$exp = 'posix';
+is($step->result(), $exp,
+ "Got expected result '$exp'");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+t/steps/auto/stat-01.t - tests Parrot::Configure step auto::stat
+
+=head1 SYNOPSIS
+
+ prove t/steps/auto/stat-01.t
+
+=head1 DESCRIPTION
+
+This file holds tests for auto::stat.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Copied: branches/html_cleanup/t/steps/auto/timespec-01.t (from r49644, trunk/t/steps/auto/timespec-01.t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/t/steps/auto/timespec-01.t Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/t/steps/auto/timespec-01.t)
@@ -0,0 +1,86 @@
+#!perl
+# Copyright (C) 2001-2007, Parrot Foundation.
+# $Id$
+# auto/timespec-01.t
+
+use strict;
+use warnings;
+use Test::More tests => 12;
+use lib qw( lib t/configure/testlib );
+use_ok('config::auto::timespec');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
+use Parrot::Configure::Test qw(
+ test_step_constructor_and_description
+);
+
+########## regular ##########
+
+my ($args, $step_list_ref) = process_options( {
+ argv => [ ],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
+
+my $pkg = q{auto::timespec};
+
+$conf->add_steps($pkg);
+$conf->options->set( %{$args} );
+my $step = test_step_constructor_and_description($conf);
+ok($step->runstep($conf), "${pkg}::runstep() returned true value");
+
+##### _handle_timespec #####
+
+my ($fail_message, $exp);
+
+$conf->data->set( HAS_TIMESPEC => undef );
+$fail_message = 'There was a problem';
+$exp = 'no';
+$step->_handle_timespec($conf, $fail_message);
+ok(defined $conf->data->get('HAS_TIMESPEC'),
+ "HAS_TIMESPEC is defined" );
+ok(! $conf->data->get('HAS_TIMESPEC'),
+ "HAS_TIMESPEC is not true, as expected" );
+is($step->result(), $exp, "Got expected result '$exp'");
+
+$conf->data->set( HAS_TIMESPEC => undef );
+$fail_message = '';
+$exp = 'yes';
+$step->_handle_timespec($conf, $fail_message);
+ok(defined $conf->data->get('HAS_TIMESPEC'),
+ "HAS_TIMESPEC is defined" );
+ok($conf->data->get('HAS_TIMESPEC'),
+ "HAS_TIMESPEC is true, as expected" );
+is($step->result(), $exp, "Got expected result '$exp'");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+t/steps/auto/timespec-01.t - tests Parrot::Configure step auto::timespec
+
+=head1 SYNOPSIS
+
+ prove t/steps/auto/timespec-01.t
+
+=head1 DESCRIPTION
+
+This file holds tests for auto::timespec.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Deleted: branches/html_cleanup/t/steps/gen/crypto-01.t
==============================================================================
--- branches/html_cleanup/t/steps/gen/crypto-01.t Sun Oct 24 12:14:32 2010 (r49644)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,83 +0,0 @@
-#! perl
-# Copyright (C) 2008, Parrot Foundation.
-# $Id$
-# gen/crypto-01.t
-
-use strict;
-use warnings;
-use Test::More tests => 8;
-use Carp;
-use lib qw( lib );
-use_ok('config::gen::crypto');
-use Parrot::Configure::Options qw( process_options );
-use Parrot::Configure::Step::Test;
-use Parrot::Configure::Test qw(
- test_step_constructor_and_description
-);
-
-########## regular ##########
-
-my ($args, $step_list_ref) = process_options(
- {
- argv => [ ],
- mode => q{configure},
- }
-);
-
-my $conf = Parrot::Configure::Step::Test->new;
-$conf->include_config_results( $args );
-
-my $serialized = $conf->pcfreeze();
-
-my $pkg = q{gen::crypto};
-$conf->add_steps($pkg);
-$conf->options->set( %{$args} );
-my $step = test_step_constructor_and_description($conf);
-
-ok(-f $step->{digest_pmc_template}, "Able to locate source code file");
-
-my $has_crypto_orig = $conf->data->get('has_crypto');
-$conf->data->set( has_crypto => undef );
-my $ret = $step->runstep($conf);
-ok( $ret, "runstep() returned true value" );
-is($step->result(), q{skipped}, "Got expected result");
-# re-set for next test
-$conf->data->set( has_crypto => $has_crypto_orig );
-$step->set_result( q{} );
-
-$conf->replenish($serialized);
-
-pass("Completed all tests in $0");
-
-################### DOCUMENTATION ###################
-
-=head1 NAME
-
- gen/crypto-01.t - test gen::crypto
-
-=head1 SYNOPSIS
-
- % prove t/steps/gen/crypto-01.t
-
-=head1 DESCRIPTION
-
-The files in this directory test functionality used by F<Configure.pl>.
-
-The tests in this file test gen::crypto.
-
-=head1 AUTHOR
-
-James E Keenan
-
-=head1 SEE ALSO
-
-config::gen::crypto, F<Configure.pl>.
-
-=cut
-
-# Local Variables:
-# mode: cperl
-# cperl-indent-level: 4
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:
Modified: branches/html_cleanup/t/steps/inter/progs-01.t
==============================================================================
--- branches/html_cleanup/t/steps/inter/progs-01.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/steps/inter/progs-01.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -54,6 +54,8 @@
ld
ccflags
linkflags
+ ar
+ arflags
ldflags
libs
cxx
Modified: branches/html_cleanup/t/steps/inter/progs-02.t
==============================================================================
--- branches/html_cleanup/t/steps/inter/progs-02.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/steps/inter/progs-02.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -51,9 +51,11 @@
qw|
cc
link
+ ar
ld
ccflags
linkflags
+ arflags
ldflags
libs
cxx
Modified: branches/html_cleanup/t/steps/inter/progs-03.t
==============================================================================
--- branches/html_cleanup/t/steps/inter/progs-03.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/steps/inter/progs-03.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -51,9 +51,11 @@
qw|
cc
link
+ ar
ld
ccflags
linkflags
+ arflags
ldflags
libs
cxx
Modified: branches/html_cleanup/t/steps/inter/progs-04.t
==============================================================================
--- branches/html_cleanup/t/steps/inter/progs-04.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/steps/inter/progs-04.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -51,9 +51,11 @@
qw|
cc
link
+ ar
ld
ccflags
linkflags
+ arflags
ldflags
libs
|
Copied: branches/html_cleanup/t/tools/create_language.t (from r49644, trunk/t/tools/create_language.t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/t/tools/create_language.t Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/t/tools/create_language.t)
@@ -0,0 +1,100 @@
+#! perl
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/tools/create_language.t - test create_language.pl
+
+=head1 SYNOPSIS
+
+ % prove t/tools/create_language.t - test create_language.pl
+
+=head1 DESCRIPTION
+
+Tests the C<tools/dev/create_language.pl> 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::Functions;
+use File::Path qw/rmtree/;
+
+my ($path, $exefile);
+
+BEGIN {
+ $path = catfile( ".", qw/tools dev create_language.pl/ );
+ $exefile = $path . $PConfig{exe};
+ unless ( -f $exefile ) {
+ plan skip_all => "$exefile hasn't been built yet.";
+ exit(0);
+ }
+ plan tests => 8;
+}
+
+
+{
+ local $TODO = "--help isn't helpful";
+
+ create_output_like(
+ "--help",
+ qr{Unknown option: help},
+ 'create_language DTRT with --help'
+ );
+ ok(!-e '--help', 'create_language does not create a language called --help');
+
+ rmtree('--help');
+}
+
+create_output_like(
+ "test_parrot_language_$$",
+ qr{creating test_parrot_language_},
+ 'create_language basic sanity'
+);
+
+my $lang_dir = "test_parrot_language_$$";
+my $build_dir = catfile($lang_dir, "build");
+my $test_dir = catfile($lang_dir, "t");
+my $src_dir = catfile($lang_dir, "src");
+my $config = catfile($lang_dir, "Configure.pl");
+ok(-e $lang_dir, "$lang_dir dir exists");
+ok(-e $build_dir, "$build_dir dir exists");
+ok(-e $test_dir, "$test_dir dir exists");
+ok(-e $src_dir, "$src_dir dir exists");
+ok(-s $config, "$config exists and has nonzero size");
+
+rmtree("test_parrot_language_$$");
+
+=head1 HELPER SUBROUTINES
+
+=head2 create_output_like
+
+ create_output_like($keys, /regexp/, $description);
+
+Runs create_language with $keys as the argument and verifies the output.
+
+=cut
+
+sub create_output_like {
+ my ($options, $snippet, $desc) = @_;
+
+ my $out = `$^X $exefile $options`;
+
+ like( $out, $snippet, $desc );
+
+ return;
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Copied: branches/html_cleanup/t/tools/mk_language_shell.t (from r49644, trunk/t/tools/mk_language_shell.t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/html_cleanup/t/tools/mk_language_shell.t Sun Oct 24 12:14:32 2010 (r49645, copy of r49644, trunk/t/tools/mk_language_shell.t)
@@ -0,0 +1,98 @@
+#! perl
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/tools/mk_language_shell.t - test mk_language_shell.pl
+
+=head1 SYNOPSIS
+
+ % prove t/tools/mk_language_shell.t - test mk_language_shell.pl
+
+=head1 DESCRIPTION
+
+Tests the C<tools/dev/mk_language_shell.pl> 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::Functions;
+use File::Path qw/rmtree/;
+
+my ($path, $exefile);
+
+BEGIN {
+ $path = catfile( ".", qw/tools dev mk_language_shell.pl/ );
+ $exefile = $path . $PConfig{exe};
+ unless ( -f $exefile ) {
+ plan skip_all => "$exefile hasn't been built yet.";
+ exit(0);
+ }
+ plan tests => 7;
+}
+
+output_like(
+ "test_parrot_language_$$",
+ qr{creating test_parrot_language_},
+ 'mk_language_shell basic sanity'
+);
+
+my $lang_dir = "test_parrot_language_$$";
+my $test_dir = catfile($lang_dir, "t");
+my $src_dir = catfile($lang_dir, "src");
+my $setup = catfile($lang_dir, "setup.pir");
+my $parrot_exe = catfile($PConfig{build_dir}, $PConfig{test_prog});
+my $to_dev_null = $^O =~ /win/ ? "1> NUL 2>&1" : ">/dev/null 2>&1";
+ok(-e $lang_dir, "$lang_dir dir exists");
+ok(-e $test_dir, "$test_dir dir exists");
+ok(-e $src_dir, "$src_dir dir exists");
+ok(-s $setup, "$setup exists and has nonzero size");
+
+my $build_status = system("cd $lang_dir; $parrot_exe setup.pir $to_dev_null");
+my $build_error = $!;
+diag("Faild to execute $parrot_exe setup.pir : $build_error") if $build_status == - 1;
+ok($build_status == 0, "language builds, exit code = " . ($build_status >> 8) );
+
+my $test_status = system("cd $lang_dir; $parrot_exe setup.pir test $to_dev_null");
+my $test_error = $!;
+diag("Faild to execute $parrot_exe setup.pir test: $test_error") if $test_status == - 1;
+ok($test_status == 0, "language passes all tests, exit code = " . ($test_status >> 8) );
+
+=head1 HELPER SUBROUTINES
+
+=head2 output_like
+
+ output_like($keys, /regexp/, $description);
+
+Runs mk_language_shell with $keys as the argument and verifies the output.
+
+=cut
+
+sub output_like {
+ my ($options, $snippet, $desc) = @_;
+
+ my $out = `$^X $exefile $options`;
+
+ like( $out, $snippet, $desc );
+
+ return;
+}
+
+END {
+ rmtree("test_parrot_language_$$");
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Modified: branches/html_cleanup/t/tools/pbc_disassemble.t
==============================================================================
--- branches/html_cleanup/t/tools/pbc_disassemble.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/tools/pbc_disassemble.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -45,7 +45,7 @@
plan skip_all => "pbc_disassemble hasn't been built. Run make parrot_utils";
exit(0);
}
- plan tests => 4;
+ plan tests => 6;
}
disassemble_output_like( <<PIR, "pir", qr/PMC_CONST.*set_n_nc.*print_n/ms, 'pbc_disassemble numeric ops');
@@ -80,6 +80,23 @@
.end
PIR
+disassemble_output_like( <<PIR, "pir", qr/set_s_sc S0,utf8:"Hello"/ms, 'pbc_disassemble utf8 string');
+.sub main :main
+ \$S0 = utf8:"Hello"
+.end
+PIR
+
+SKIP: {
+ skip( 'no ICU lib', 1 ) unless $PConfig{has_icu};
+ my $utf16 = pack('S*', unpack('C*', 'Hello'));
+ $utf16 =~ s/\0/\\\\0/g;
+ disassemble_output_like( <<PIR, "pir", qr/set_s_sc S0,utf16:"$utf16"/ms, 'pbc_disassemble utf16 string');
+.sub main :main
+ \$S0 = utf16:"Hello"
+.end
+PIR
+}
+
=head1 HELPER SUBROUTINES
=head2 disassemble_output_like
Modified: branches/html_cleanup/t/tools/pbc_dump.t
==============================================================================
--- branches/html_cleanup/t/tools/pbc_dump.t Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/t/tools/pbc_dump.t Sun Oct 24 12:14:32 2010 (r49645)
@@ -45,7 +45,7 @@
plan skip_all => "pbc_dump hasn't been built. Run make parrot_utils";
exit(0);
}
- plan tests => 7;
+ plan tests => 13;
}
dump_output_like( <<PIR, "pir", [qr/CONSTANT_t/, qr/BYTECODE_t/], 'pbc_dump basic sanity');
@@ -72,6 +72,17 @@
.end
PIR
+for my $enc qw(binary iso-8859-1 utf8 utf16 ucs2 ucs4) {
+ SKIP: {
+ skip( 'no ICU lib', 1 ) if $enc eq 'utf16' && !$PConfig{has_icu};
+ dump_output_like( <<PIR, "pir", qr/ENCODING.*=>.*$enc/ms, "pbc_dump $enc encoding");
+.sub main :main
+ \$S0 = $enc:"abc"
+.end
+PIR
+ }
+}
+
my $longcode = ".sub main :main\n";
for (0 ... 10000) {
$longcode .= "\$I0 = \$I0 + 1234\n";
Modified: branches/html_cleanup/tools/release/release.json
==============================================================================
--- branches/html_cleanup/tools/release/release.json Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/tools/release/release.json Sun Oct 24 12:14:32 2010 (r49645)
@@ -1,6 +1,6 @@
{
- "release.version" : "2.9.0",
- "release.name" : "Red-masked",
+ "release.version" : "2.9.1",
+ "release.name" : "(bugfix release)",
"release.day" : "Tuesday",
"release.date" : "19 October 2010",
"release.nextdate" : "16 November 2010",
@@ -16,6 +16,6 @@
"wiki.root" : "https://trac.parrot.org/parrot/wiki/",
"wiki.bugday" : "bug_day_2010_11_13",
- "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/supported/2.9.0/",
+ "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/supported/2.9.1/",
"subversion.root" : "http://subversion.apache.org/"
}
Modified: branches/html_cleanup/tools/release/templates.json
==============================================================================
--- branches/html_cleanup/tools/release/templates.json Sun Oct 24 10:32:49 2010 (r49644)
+++ branches/html_cleanup/tools/release/templates.json Sun Oct 24 12:14:32 2010 (r49645)
@@ -6,7 +6,7 @@
\"@release.name at .\" Parrot (@web.root@) is a virtual machine aimed
at running all dynamic languages.
-Parrot @release.version@ is available on Parrot's FTP site, or follow the
+Parrot @release.version@ is available on Parrot's FTP site, or by following the
download instructions at @web.root@@web.source at . For those who would like to
develop on Parrot, or help develop Parrot itself, we recommend using Subversion
on the source code repository to get the latest and best Parrot code.
@@ -28,7 +28,7 @@
is a virtual machine aimed at running all dynamic languages.</p>
<p>Parrot @release.version@ is available on <a href=\"@ftp.path@\">Parrot's FTP
-site</a>, or <a href=\"@web.root@@web.source@\">follow the download
+site</a>, or by <a href=\"@web.root@@web.source@\">following the download
instructions</a>. For those who would like to develop on Parrot, or help
develop Parrot itself, we recommend using <a
href=\"@subversion.root@\">Subversion</a> on <a href=\"@web.repository@\">our
More information about the parrot-commits
mailing list