[perl #60600] [PATCH] rewrite of ops.t to PIR

2008-11-18 Thread via RT
# New Ticket Created by  Bruce Stockwell 
# Please include the string:  [perl #60600]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60600 


rewrite of t/oo/ops.t to PIR.

 ops.t |  265
--
 1 file changed, 130 insertions(+), 135 deletions(-)

-- 
V/r
Bruce
Index: t/oo/ops.t
===
--- t/oo/ops.t	(revision 32667)
+++ t/oo/ops.t	(working copy)
@@ -1,13 +1,7 @@
-#!perl
+#! parrot
 # Copyright (C) 2007, The Perl Foundation.
 # $Id$
 
-use strict;
-use warnings;
-use lib qw( . lib ../lib ../../lib );
-use Test::More;
-use Parrot::Test tests = 8;
-
 =head1 NAME
 
 t/oo/ops.t - test OO related ops
@@ -22,156 +16,169 @@
 
 =cut
 
-pir_output_is( 'CODE', 'OUT', 'addrole_p_p' );
-.sub 'test' :main
+.sub main :main
+.include 'test_more.pir' 
+
+plan(20)
+
+op_addrole_p_p()
+op_inspect_p_p()
+op_inspect_p_p_s()
+op_get_class_p_s()
+op_get_class_p_p()
+op_addattribute_p_s()
+op_new_p_s()
+op_can_i_p_s()
+
+.end
+
+.sub op_addrole_p_p
 $P0 = new 'Role'
 $P1 = new 'Class'
+
+try:
+push_eh catch
 addrole $P1, $P0
-print ok 1 - addrole op executed\n
+$I0 = 1 #addrole w/ no exception. set register for ok
 
 $P2 = $P1.'roles'()
-$I0 = elements $P2
-if $I0 == 1 goto ok_2
-print not 
-ok_2:
-print ok 2 - addrole op actually added the role\n
+$I1 = elements $P2
+goto finally
+
+catch:
+$I0 = 0 #set register for fail
+$I1 = 0 #set register for fail
+
+finally:
+pop_eh
+ok ($I0, 'addrole op executed')
+is ($I1, 1, 'role verified')
+
 .end
-CODE
-ok 1 - addrole op executed
-ok 2 - addrole op actually added the role
-OUT
 
-pir_output_is( 'CODE', 'OUT', 'inspect_p_p' );
-.sub 'test' :main
+.sub op_inspect_p_p
 $P0 = new 'Class'
 
+try:
+push_eh catch
 $P1 = inspect $P0
-print ok 1 - inspect_p_p op executed\n
+$I0 = 1 #inspect w/ no exception. set register for ok
+$I1 = elements $P1
+goto finally
 
-$I0 = elements $P1
-if $I0 == 7 goto ok_2
-print not 
-ok_2:
-print ok 2 - returned hash had correct number of elements\n
+catch:
+$I0 = 0 #inspect w/ exception. set register for fail
+
+finally:
+pop_eh
+ok ($I0, 'inspect op executed')
+is ($I1, 7, 'inspect hash count verified')
+
 .end
-CODE
-ok 1 - inspect_p_p op executed
-ok 2 - returned hash had correct number of elements
-OUT
 
-pir_output_is( 'CODE', 'OUT', 'inspect_p_p_s' );
-.sub 'test' :main
+.sub op_inspect_p_p_s
 $P0 = new 'Class'
 $P0.'name'('foo')
 $P0.'add_attribute'('a')
 
 $P1 = inspect $P0, 'name'
-say $P1
-print ok 1 - inspect_p_p_s with $3='name'\n
+is ($P1, 'foo', 'inpect_p_p_s with name')
 
 $P1 = inspect $P0, 'flags'
 $I0 = $P1
 $I1 = 1  29 # flag 29 is PObj_is_class_FLAG
-
 $I2 = $I0  $I1
-if $I2 goto flags_ok
-  print not 
-flags_ok:
-print ok 2 - inspect_p_p_s with $3='flags'\n
+ok ($I2, 'inspect_p_p_s with flags')
 
 $P1 = inspect $P0, 'attributes'
 $I0 = elements $P1
-if $I0 == 1 goto ok_2
-print not 
-ok_2:
-print ok 3 - inspect_p_p_s with $3='attributes'\n
+is ($I0, 1, 'inspect_p_p_s with attributes')
 .end
-CODE
-foo
-ok 1 - inspect_p_p_s with $3='name'
-ok 2 - inspect_p_p_s with $3='flags'
-ok 3 - inspect_p_p_s with $3='attributes'
-OUT
 
-pir_output_is( 'CODE', 'OUT', 'get_class_p_s' );
-.sub main :main
+.sub op_get_class_p_s
 $P0 = new 'Hash'
 $P4 = new 'String'
 $P4 = 'Monkey'
 $P0['name'] = $P4
 
 $P1 = new 'Class', $P0
-print ok 1 - created new class named Monkey\n
+$I0 = isa $P1 , 'Class'
 
-push_eh nok_2
+try:
+push_eh catch
 $P2 = get_class 'Monkey'
+$I1 = isa $P2 , 'Class'
+goto finally
+
+catch:
+$I1 = 0 # get_class w/ exception. set flag for failure
+
+finally:
 pop_eh
-goto ok_2
-nok_2:
-print not 
-ok_2:
-print ok 2 - get_class found a class\n
 
+unless null $P2 goto ok
+$P2 = new 'Class' # help inspect('name') fail gracefully
+ok:
 $P3 = $P2.'inspect'('name')
-print $P3
-print \nok 3 - got name of found class\n
+
+ok ($I0, 'created new class named Monkey')
+ok ($I1, 'get_class found a class')
+is ($P3, 'Monkey', 'got name of found class')
 .end
-CODE
-ok 1 - created new class named Monkey
-ok 2 - get_class found a class
-Monkey
-ok 3 - got name of found class
-OUT
 
-pir_output_is( 'CODE', 'OUT', 'get_class_p_p' );
-.sub main :main
+.sub op_get_class_p_p 
 $P0 = new 'Hash'
 $P4 = new 'String'
-$P4 = 'Monkey'
+$P4 = 'Ape'
 $P0['name'] = $P4
 
 $P1 = new 'Class', $P0
-print ok 1 - created new class named Monkey\n
+$I0 = isa $P1 , 'Class'
 
-push_eh nok_2
-$P2 = get_class [ 'Monkey' ]
+try:
+push_eh catch
+$P2 = get_class [ 'Ape' ]
+$I1 = isa 

[svn:parrot-pdd] r32758 - trunk/docs/pdds

2008-11-18 Thread infinoid
Author: infinoid
Date: Sun Nov 16 21:00:21 2008
New Revision: 32758

Modified:
   trunk/docs/pdds/pdd19_pir.pod

Log:
[codingstd] wrap lines in pdd19_pir.pod to make t/codingstd/pdd_format.t happy.


Modified: trunk/docs/pdds/pdd19_pir.pod
==
--- trunk/docs/pdds/pdd19_pir.pod   (original)
+++ trunk/docs/pdds/pdd19_pir.pod   Sun Nov 16 21:00:21 2008
@@ -534,10 +534,10 @@
 
 =item :nsentry( string_constant )
 
-Specify the name by which the subroutine is stored in the namespace. The 
default
-name by which a subroutine is stored in the namespace (if this flag is 
missing),
-is the subroutine's name as given after the C.sub directive. This flag allows
-to override this.
+Specify the name by which the subroutine is stored in the namespace. The
+default name by which a subroutine is stored in the namespace (if this flag
+is missing), is the subroutine's name as given after the C.sub directive.
+This flag allows to override this.
 
 =back
 


[perl #60606] Fix parallel make for installable target

2008-11-18 Thread via RT
# New Ticket Created by  Luca Barbato 
# Please include the string:  [perl #60606]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60606 


make -jN installable fails since the installable debugger and pbc_merge 
are missing the config$(O) in their deps.

patch to fix it attached

lu

-- 

Luca Barbato
Gentoo Council Member
Gentoo/linux Gentoo/PPC
http://dev.gentoo.org/~lu_zero

--- config/gen/makefiles/root.in.old	2008-10-07 16:25:19.0 +0200
+++ config/gen/makefiles/root.in	2008-11-17 11:23:09.0 +0100
@@ -910,7 +910,7 @@
 @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
 #CONDITIONED_LINE(win32):	if exist [EMAIL PROTECTED] mt.exe -nologo -manifest [EMAIL PROTECTED] -outputresource:$@;1
 
-$(INSTALLABLEPDB) : $(SRC_DIR)/parrot_debugger$(O) $(LIBPARROT)
+$(INSTALLABLEPDB) : $(SRC_DIR)/parrot_debugger$(O) $(LIBPARROT) $(SRC_DIR)/parrot_config$(O)
 	$(LINK) @[EMAIL PROTECTED]@ \
 $(SRC_DIR)/parrot_debugger$(O) \
 $(SRC_DIR)/parrot_config$(O) \
@@ -980,7 +980,7 @@
 @rpath_blib@ $(ALL_PARROT_LIBS) $(LINK_DYNAMIC) $(LINKFLAGS)
 #CONDITIONED_LINE(win32):	if exist [EMAIL PROTECTED] mt.exe -nologo -manifest [EMAIL PROTECTED] -outputresource:$@;1
 
-$(INSTALLABLEPBCMERGE) : $(SRC_DIR)/pbc_merge$(O) $(LIBPARROT)
+$(INSTALLABLEPBCMERGE) : $(SRC_DIR)/pbc_merge$(O) $(LIBPARROT) $(INSTALLABLECONFIG) 
 	$(LINK) @[EMAIL PROTECTED]@ \
 $(SRC_DIR)/pbc_merge$(O) \
 $(SRC_DIR)/install_config$(O) \


[perl #60608] [PATCH] Fix install when libdir is different from $prefix/lib

2008-11-18 Thread via RT
# New Ticket Created by  Luca Barbato 
# Please include the string:  [perl #60608]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60608 


Currently install_files.pl does not abide to the --libdir option for the 
runtime. The patch fixes this behaviour.

lu

-- 

Luca Barbato
Gentoo Council Member
Gentoo/linux Gentoo/PPC
http://dev.gentoo.org/~lu_zero

--- parrot-0.8.0/tools/dev/install_files.pl	2008-05-22 19:56:38.0 +0200
+++ tools/dev/install_files.pl	2008-11-17 12:10:10.0 +0100
@@ -202,8 +202,10 @@
 # --pkgconfigdir option.
 $dest = File::Spec-catdir( $options{libdir}, 'pkgconfig', $dest );
 }
+elsif ( /\[library]/ ) {
+$dest =~ s/^runtime/$options{libdir}/;
+}
 else {
-$dest =~ s/^runtime/lib/ if /\[library]/;
 $dest = File::Spec-catdir( $options{prefix}, $dest );
 }
 


[perl #60616] [PATCH] Fix CONST_STRING line numbers

2008-11-18 Thread via RT
# New Ticket Created by  Andy Dougherty 
# Please include the string:  [perl #60616]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60616 


The latest version of Sun's compiler, 
cc: Sun Ceres C 5.10 SunOS_i386 2008/10/22
needs the following patch to compile parrot.  The problem appears to be
the same one already documented for icc in tools/build/c2str.pl:

# NOTE: when CONST_STRING gets used it and any macro invocations
# that it is used in *should not* be split across more than one
# line, because some compilers generate line numbers in such cases
# differently from the way gcc does this (a case in point is
# Intel's C compiler, icc) and hence the #defined CONST_STRING
# won't be found by the compiler.

This patch re-joins CONST_STRING invocations that have been split across
more than one line.  This will undoubtedly fall afoul of some coding
standard test, but I think compiling trumps passing a line-length test.

Ultimately, it might be nice if there weren't this arbitrary restriction,
but I'd have to dig much deeper before I understood the whole process
well enough to propose a better solution.


diff -r -u parrot-current/src/exceptions.c parrot-suncc/src/exceptions.c
--- parrot-current/src/exceptions.c 2008-11-05 11:15:17.0 -0500
+++ parrot-suncc/src/exceptions.c   2008-11-17 14:22:33.0 -0500
@@ -71,10 +71,8 @@
 {
 PMC *exception = pmc_new(interp, enum_class_Exception);
 
-VTABLE_set_integer_keyed_str(interp, exception,
-CONST_STRING(interp, severity), severity);
-VTABLE_set_integer_keyed_str(interp, exception,
-CONST_STRING(interp, type), error);
+VTABLE_set_integer_keyed_str(interp, exception, CONST_STRING(interp, 
severity), severity);
+VTABLE_set_integer_keyed_str(interp, exception, CONST_STRING(interp, 
type), error);
 if (msg)
 VTABLE_set_string_native(interp, exception, msg);
 
@@ -103,8 +101,7 @@
 else {
 STRING * const message = VTABLE_get_string(interp, exception);
 INTVAL exit_status = 1;
-const INTVAL severity = VTABLE_get_integer_keyed_str(interp,
-exception, CONST_STRING(interp, severity));
+const INTVAL severity = VTABLE_get_integer_keyed_str(interp, 
exception, CONST_STRING(interp, severity));
 
 /* flush interpreter output to get things printed in order */
 PIO_flush(interp, PIO_STDOUT(interp));
@@ -122,8 +119,7 @@
 }
 else if (severity == EXCEPT_exit) {
 /* TODO: get exit status based on type */
-exit_status = VTABLE_get_integer_keyed_str(interp,
-exception, CONST_STRING(interp, exit_code));
+exit_status = VTABLE_get_integer_keyed_str(interp, exception, 
CONST_STRING(interp, exit_code));
 }
 else {
 PIO_eprintf(interp, No exception handler and no message\n);
@@ -284,8 +280,7 @@
 }
 
 if (Interp_debug_TEST(interp, PARROT_BACKTRACE_DEBUG_FLAG)) {
-int exitcode = VTABLE_get_integer_keyed_str(interp, exception,
-CONST_STRING(interp, exit_code));
+int exitcode = VTABLE_get_integer_keyed_str(interp, exception, 
CONST_STRING(interp, exit_code));
 STRING *msg = VTABLE_get_string(interp, exception);
 PIO_eprintf(interp,
 Parrot_ex_throw_from_c (severity:%d error:%d): %Ss\n,
@@ -430,8 +425,7 @@
 void
 Parrot_ex_mark_unhandled(PARROT_INTERP, ARGIN(PMC *exception))
 {
-VTABLE_set_integer_keyed_str(interp, exception,
-CONST_STRING(interp, handled), -1);
+VTABLE_set_integer_keyed_str(interp, exception, CONST_STRING(interp, 
handled), -1);
 }
 
 /*
diff -r -u parrot-current/src/inter_call.c parrot-suncc/src/inter_call.c
--- parrot-current/src/inter_call.c 2008-10-23 19:15:10.0 -0400
+++ parrot-suncc/src/inter_call.c   2008-11-17 14:22:57.0 -0500
@@ -2610,8 +2610,7 @@
 PMC * const args_sig= pmc_new(interp, enum_class_FixedIntegerArray);
 PMC * const results_sig = pmc_new(interp, enum_class_FixedIntegerArray);
 PMC * const ret_cont= new_ret_continuation_pmc(interp, NULL);
-PMC * const result_list = VTABLE_get_attr_str(interp, sig_obj,
-CONST_STRING(interp, returns));
+PMC * const result_list = VTABLE_get_attr_str(interp, sig_obj, 
CONST_STRING(interp, returns));
 
 Parrot_Context *ctx;
 opcode_t *dest;
diff -r -u parrot-current/src/multidispatch.c parrot-suncc/src/multidispatch.c
--- parrot-current/src/multidispatch.c  2008-11-05 03:15:14.0 -0500
+++ parrot-suncc/src/multidispatch.c2008-11-17 14:23:33.0 -0500
@@ -435,8 +435,7 @@
 /* Only create the returns array if it's needed */
 if (in_return_sig  PMC_IS_NULL(returns)) {
 returns = pmc_new(interp, enum_class_ResizablePMCArray);
-VTABLE_set_attr_str(interp, call_object,
-

[perl #60626] [DEPRECATED] Old-style MMD functions

2008-11-18 Thread via RT
# New Ticket Created by  Jerry Gay 
# Please include the string:  [perl #60626]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60626 


from DEPRECATED.pod:

  =item Old-style MMD functions [post 0.7.1]

  Parrot_mmd_add_function, mmd_expand_x, mmd_expand_y, Parrot_mmd_register,
  Parrot_mmd_register_sub, Parrot_mmd_destroy,
Parrot_MMD_search_default_infix,
  Parrot_mmd_search_default, mmd_cvt_to_types.

this is a tracking ticket for that effort.
~jerry


Re: [perl #60616] [PATCH] Fix CONST_STRING line numbers

2008-11-18 Thread Nicholas Clark
On Mon, Nov 17, 2008 at 11:37:23AM -0800, Andy Dougherty wrote:

 The latest version of Sun's compiler, 
 cc: Sun Ceres C 5.10 SunOS_i386 2008/10/22
 needs the following patch to compile parrot.  The problem appears to be
 the same one already documented for icc in tools/build/c2str.pl:
 
 # NOTE: when CONST_STRING gets used it and any macro invocations
 # that it is used in *should not* be split across more than one
 # line, because some compilers generate line numbers in such cases
 # differently from the way gcc does this (a case in point is
 # Intel's C compiler, icc) and hence the #defined CONST_STRING
 # won't be found by the compiler.

Shouldn't there be a coding standard to enforce *that*?

Nicholas Clark


Re: [perl #60600] [PATCH] rewrite of ops.t to PIR

2008-11-18 Thread Bruce Stockwell
On Mon, Nov 17, 2008 at 3:23 PM, Christoph Otto via RT 
[EMAIL PROTECTED] wrote:

 On Sun Nov 16 19:47:36 2008, stockwellb wrote:
  rewrite of t/oo/ops.t to PIR.
 
   ops.t |  265
  --
   1 file changed, 130 insertions(+), 135 deletions(-)
 

 In op_get_class_p_p, it looks like you switch from Ape to Monkey
 when getting the class from a namespace.  I can't picture this causing
 any problems, but it's a good idea to keep the subs as self-contained as
 possible.  As changing Monkey to Ape in that sub doesn't cause any
 failures, is there any reason not to do so?


Yes.  Monkey is already a registered class in an earlier  test sub.
Namespaces seemed like overkill so I just used another Class name.



 Also, tests should be very explicit about which exception type(s)
 they're catching.  This keeps other incidental exceptions from masking
 bugs.  The first test in t/pmc/ro.t is a good example of what to do.
 You can find the exception type by acking Parrot for the exception's
 message.


Thanks for the help on this one. I hadn't done anything with
ExceptionHandlers yet. I removed several error traps as they were general.
The remaining one is now trapping for an explicit error.



 Other than that, the patch looks good.  Make those changes and I'll be
 glad to apply it.


I'm attaching the diff.  I hope this is the correct way.
 ops.t |  219
+++---
 1 file changed, 78 insertions(+), 141 deletions(-)





 Christoph




-- 
V/r
Bruce
Index: t/oo/ops.t
===
--- t/oo/ops.t	(revision 32667)
+++ t/oo/ops.t	(working copy)
@@ -1,13 +1,7 @@
-#!perl
+#! parrot
 # Copyright (C) 2007, The Perl Foundation.
 # $Id$
 
-use strict;
-use warnings;
-use lib qw( . lib ../lib ../../lib );
-use Test::More;
-use Parrot::Test tests = 8;
-
 =head1 NAME
 
 t/oo/ops.t - test OO related ops
@@ -22,156 +16,107 @@
 
 =cut
 
-pir_output_is( 'CODE', 'OUT', 'addrole_p_p' );
-.sub 'test' :main
+.include 'except_types.pasm'
+.sub main :main
+.include 'test_more.pir' 
+
+plan(18)
+
+op_addrole_p_p()
+op_inspect_p_p()
+op_inspect_p_p_s()
+op_get_class_p_s()
+op_get_class_p_p()
+op_addattribute_p_s()
+op_new_p_s()
+op_can_i_p_s()
+
+.end
+
+.sub op_addrole_p_p
 $P0 = new 'Role'
 $P1 = new 'Class'
-addrole $P1, $P0
-print ok 1 - addrole op executed\n
 
+addrole $P1, $P0
 $P2 = $P1.'roles'()
-$I0 = elements $P2
-if $I0 == 1 goto ok_2
-print not 
-ok_2:
-print ok 2 - addrole op actually added the role\n
+$I1 = elements $P2
+is ($I1, 1, 'addrole op executed and  verified')
+
 .end
-CODE
-ok 1 - addrole op executed
-ok 2 - addrole op actually added the role
-OUT
 
-pir_output_is( 'CODE', 'OUT', 'inspect_p_p' );
-.sub 'test' :main
+.sub op_inspect_p_p
 $P0 = new 'Class'
 
 $P1 = inspect $P0
-print ok 1 - inspect_p_p op executed\n
+$I1 = elements $P1
+is ($I1, 7, 'inspect op executed and hash count verified')
 
-$I0 = elements $P1
-if $I0 == 7 goto ok_2
-print not 
-ok_2:
-print ok 2 - returned hash had correct number of elements\n
 .end
-CODE
-ok 1 - inspect_p_p op executed
-ok 2 - returned hash had correct number of elements
-OUT
 
-pir_output_is( 'CODE', 'OUT', 'inspect_p_p_s' );
-.sub 'test' :main
+.sub op_inspect_p_p_s
 $P0 = new 'Class'
 $P0.'name'('foo')
 $P0.'add_attribute'('a')
 
 $P1 = inspect $P0, 'name'
-say $P1
-print ok 1 - inspect_p_p_s with $3='name'\n
+is ($P1, 'foo', 'inspect_p_p_s with name')
 
 $P1 = inspect $P0, 'flags'
 $I0 = $P1
 $I1 = 1  29 # flag 29 is PObj_is_class_FLAG
-
 $I2 = $I0  $I1
-if $I2 goto flags_ok
-  print not 
-flags_ok:
-print ok 2 - inspect_p_p_s with $3='flags'\n
+ok ($I2, 'inspect_p_p_s with flags')
 
 $P1 = inspect $P0, 'attributes'
 $I0 = elements $P1
-if $I0 == 1 goto ok_2
-print not 
-ok_2:
-print ok 3 - inspect_p_p_s with $3='attributes'\n
+is ($I0, 1, 'inspect_p_p_s with attributes')
 .end
-CODE
-foo
-ok 1 - inspect_p_p_s with $3='name'
-ok 2 - inspect_p_p_s with $3='flags'
-ok 3 - inspect_p_p_s with $3='attributes'
-OUT
 
-pir_output_is( 'CODE', 'OUT', 'get_class_p_s' );
-.sub main :main
+.sub op_get_class_p_s
 $P0 = new 'Hash'
 $P4 = new 'String'
 $P4 = 'Monkey'
 $P0['name'] = $P4
 
 $P1 = new 'Class', $P0
-print ok 1 - created new class named Monkey\n
+$I0 = isa $P1 , 'Class'
+ok ($I0, 'created new class named Monkey')
 
-push_eh nok_2
 $P2 = get_class 'Monkey'
-pop_eh
-goto ok_2
-nok_2:
-print not 
-ok_2:
-print ok 2 - get_class found a class\n
+$I1 = isa $P2 , 'Class'
+ok ($I1, 'get_class found a class')
 
 $P3 = $P2.'inspect'('name')
-print $P3
-print \nok 3 - got name of found class\n
+is ($P3, 'Monkey', 'got name of found 

[perl #60624] [DEPRECATED] PARROT_API changes to PARROT_EXPORT

2008-11-18 Thread via RT
# New Ticket Created by  Jerry Gay 
# Please include the string:  [perl #60624]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60624 


from DEPRECATED.pod:

  =item PARROT_API changes to PARROT_EXPORT [post 0.8.1]

  The PARROT_API name suggests something that is not the case yet.  This
will
  become PARROT_EXPORT after November 2008 release.  (We will reintroduce
  PARROT_API on specific functions where appropriate post 1.0.0.)

this is the rt tracking ticket. the work has begun in the api2export branch.
~jerry


Re: [perl #60624] [DEPRECATED] PARROT_API changes to PARROT_EXPORT

2008-11-18 Thread Andrew Whitworth
On Mon, Nov 17, 2008 at 9:50 PM, via RT Jerry Gay
[EMAIL PROTECTED] wrote:
 # New Ticket Created by  Jerry Gay
 # Please include the string:  [perl #60624]
 # in the subject line of all future correspondence about this issue.
 # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60624 


 from DEPRECATED.pod:

  =item PARROT_API changes to PARROT_EXPORT [post 0.8.1]

  The PARROT_API name suggests something that is not the case yet.  This
 will
  become PARROT_EXPORT after November 2008 release.  (We will reintroduce
  PARROT_API on specific functions where appropriate post 1.0.0.)

 this is the rt tracking ticket. the work has begun in the api2export branch.

Is this the only purpose of the branch, to change PARROT_API to
PARROT_EXPORT? If so, it seems like it could be done in a single sed
job and not need an entire branch for it.

--Andrew Whitworth


[perl #60634] [PATCH] Minor test tempfile cleanup

2008-11-18 Thread via RT
# New Ticket Created by  Andy Dougherty 
# Please include the string:  [perl #60634]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60634 


This patch cleans up a few test files left in /tmp by the test suite.

diff -r -u parrot-current/t/compilers/imcc/syn/file.t 
parrot-andy/t/compilers/imcc/syn/file.t
--- parrot-current/t/compilers/imcc/syn/file.t  2008-11-18 08:04:17.0 
-0500
+++ parrot-andy/t/compilers/imcc/syn/file.t 2008-11-18 08:31:49.0 
-0500
@@ -490,7 +490,7 @@
 without_slash() called!
 OUT
 }
-
+unlink(@temp_files);
 $ended_ok = 1;
 
 exit;
diff -r -u parrot-current/t/pmc/sub.t parrot-andy/t/pmc/sub.t
--- parrot-current/t/pmc/sub.t  2008-11-18 08:04:16.0 -0500
+++ parrot-andy/t/pmc/sub.t 2008-11-18 08:37:06.0 -0500
@@ -660,7 +660,7 @@
 /too few arguments passed \(1\) - 2 params expected/
 OUTPUT
 
-($TEMP, $temp_pasm) = create_tempfile();
+($TEMP, $temp_pasm) = create_tempfile(UNLINK = 1);
 print $TEMP 'EOF';
 .sub _sub1 :load
   say in sub1
@@ -681,7 +681,7 @@
 back
 OUTPUT
 
-($TEMP, $temp_pasm) = create_tempfile();
+($TEMP, $temp_pasm) = create_tempfile(UNLINK = 1);
 print $TEMP 'EOF';
 .sub _foo
   print error\n

-- 
Andy Dougherty  [EMAIL PROTECTED]


Re: [perl #60624] [DEPRECATED] PARROT_API changes to PARROT_EXPORT

2008-11-18 Thread jerry gay
On Tue, Nov 18, 2008 at 05:16, Andrew Whitworth [EMAIL PROTECTED]wrote:

 On Mon, Nov 17, 2008 at 9:50 PM, via RT Jerry Gay
 [EMAIL PROTECTED] wrote:
  # New Ticket Created by  Jerry Gay
  # Please include the string:  [perl #60624]
  # in the subject line of all future correspondence about this issue.
  # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60624 
 
 
  from DEPRECATED.pod:
 
   =item PARROT_API changes to PARROT_EXPORT [post 0.8.1]
 
   The PARROT_API name suggests something that is not the case yet.  This
  will
   become PARROT_EXPORT after November 2008 release.  (We will reintroduce
   PARROT_API on specific functions where appropriate post 1.0.0.)
 
  this is the rt tracking ticket. the work has begun in the api2export
 branch.

 Is this the only purpose of the branch, to change PARROT_API to
 PARROT_EXPORT? If so, it seems like it could be done in a single sed
 job and not need an entire branch for it.

 --Andrew Whitworth


yes, that's the purpose. however, it can't be done until after release, it
must be tested on multiple platforms since it affects the build, and some
files (like NEWS and DEPRECATED.pod) don't change. the branch will likely be
merged with trunk today or tomorrow. it builds on windows, and i will test
it on linux now.

branches are cheap.
~jerry


[perl #60632] [TODO] codingstd: No line splitting in CONST_STRING

2008-11-18 Thread via RT
# New Ticket Created by  Bernhard Schmalhofer 
# Please include the string:  [perl #60632]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60632 


In RT#60161 Nick Clark remarked:

On Mon, Nov 17, 2008 at 11:37:23AM -0800, Andy Dougherty wrote:

  The latest version of Sun's compiler,
  cc: Sun Ceres C 5.10 SunOS_i386 2008/10/22
  needs the following patch to compile parrot. The problem appears to be
  the same one already documented for icc in tools/build/c2str.pl:
 
  # NOTE: when CONST_STRING gets used it and any macro invocations
  # that it is used in *should not* be split across more than one
  # line, because some compilers generate line numbers in such cases
  # differently from the way gcc does this (a case in point is
  # Intel's C compiler, icc) and hence the #defined CONST_STRING
  # won't be found by the compiler.

Shouldn't there be a coding standard to enforce *that*?



This sounds sane and should be implemented. Takers are welcome.




Re: [perl #60554] BUG: 'our' variables getting lost in NQP actions

2008-11-18 Thread Patrick R. Michaud
On Sat, Nov 15, 2008 at 11:46:01AM -0800, Bernhard Schmalhofer wrote:
 In Pipp I encountered the problem that an our variables  seem to get 
 lost in NQP actions.
 This means that I had set an our variable in one action. When trying to 
 look at the
 variable in a subsequently called action, the variable was not defined.
 However this was not reproducible. Using the variable in another action 
 worked as expected.
 
 In t/compilers/pct/complete_workflow.t:84 I added a TODO test case that 
 illustrates this
 behavior.

The test case appears to have incorrect logic.

$?MY_OUR_VAR appears to be set by the action method for TOP, but the
action method for thingy will be called _before_ the action method
for TOP.  Thus it's pretty clear that thingy won't see the setting
of $?MY_OUR_VAR because it hasn't occurred yet.

Pm


Re: [perl #60554] BUG: 'our' variables getting lost in NQP actions

2008-11-18 Thread Bernhard Schmalhofer

Patrick R. Michaud via RT schrieb:

On Sat, Nov 15, 2008 at 11:46:01AM -0800, Bernhard Schmalhofer wrote:
  
In Pipp I encountered the problem that an our variables  seem to get 
lost in NQP actions.
This means that I had set an our variable in one action. When trying to 
look at the

variable in a subsequently called action, the variable was not defined.
However this was not reproducible. Using the variable in another action 
worked as expected.


In t/compilers/pct/complete_workflow.t:84 I added a TODO test case that 
illustrates this

behavior.



The test case appears to have incorrect logic.

$?MY_OUR_VAR appears to be set by the action method for TOP, but the
action method for thingy will be called _before_ the action method
for TOP.  Thus it's pretty clear that thingy won't see the setting
of $?MY_OUR_VAR because it hasn't occurred yet.

Pm


  

I think that I misunderstood how actions work.
I thought that the action for thingy is called by the line:

  make $( $thingy );

But is looks like it is called during the matching process, which make 
perfect sense.

So my real problem is:
   In the action for thingy how do I determine that the match is 
below TOP?
I need this for distinguishing between function scope and global scope 
of variables in PHP.


Regards,
  Bernhard






Re: 'our' variables getting lost in NQP actions (was: #60554)

2008-11-18 Thread Patrick R. Michaud
[Moving this thread out of the ticket queue because it's no longer
relevant to the original ticket.)

On Tue, Nov 18, 2008 at 07:26:47PM +0100, Bernhard Schmalhofer wrote:
 So my real problem is:
In the action for thingy how do I determine that the match is below 
 TOP?

How do you mean determine that the match is below TOP?  From the
example that was in the test file, it's clear that thingy is
below TOP because that's the only place it's called from.

I think you're wanting higher rules to be able to store state information
for subrules.  There are at least a couple of ways to do something like
this:

1.  With a special subrule:

grammar Foo {
token TOP{ .INIT thingy {*} }
token INIT   { {*} }
token thingy { 'thingy' {*} }
}

...
method TOP($/) { make $( $thingy ); }

method INIT($/) {
   our $?MY_OUR_VAR := 'was passed down';
}

method thingy($/) {
our $?MY_OUR_VAR;
my $past := PAST::Op.new( 
:pirop('say'),
PAST::Val.new( 
:value( 'our var ' ~ $?MY_OUR_VAR )
)
);
make $past;
}

Here the .INIT subrule gets called before thingy, so
its actions take place before thingy is parsed.

2.  With action keys:

grammar Foo {
token TOP {
{*}#= init
thingy
{*}#= close
}
token thingy { 'thingy' {*} }
}

...
method TOP($/, $key) {
if $key eq 'init' {
our $?MY_OUR_VAR := 'was passed down';
}
if $key eq 'close' {
make $( $thingy );
}
}

Here the TOP action method gets called twice -- once
with a $key of 'init' when TOP is first entered, and again
with a key of 'close' after thingy has been parsed.

Note that in Rakudo we do this very rarely, though, as
the design of PCT is intended to be such that the compiler
doesn't have to always know exactly how something was
declared in an outer scope in order to generate the
correct thing in an inner scope.

That said, I am planning to have PCT provide a way to
quickly look up symbols in outer block nodes for when
it is needed.

Pm


Re: [perl #60622] [BUG] t/pmc/pmc.t failing on Darwin

2008-11-18 Thread chromatic
On Tuesday 18 November 2008 04:27:38 James Keenan via RT wrote:

 On Mon Nov 17 19:30:10 2008, [EMAIL PROTECTED] wrote:

  I need to see more, but I think I know what this is.  Use the 'bt'
  command in gdb to show the whole backtrace.  Hopefully it includes
  Parrot_really_destroy().

 Sorry to have forgotten that step.  See attachment.

A real fix is getting order-of-destruction working, but I turned the 
concurrency scheduler into a constant PMC and added a live flag flip right 
before marking the concurrency scheduler, so that its custom mark always runs 
so that its kids always get marked as live appropriately.

Fixed in r32841.

-- c


Parrot 0.8.1 Tio Richie Released!

2008-11-18 Thread chromatic
   On behalf of the Parrot team, I'm proud to announce Parrot 0.8.1 Tio
   Richie. [1]  Parrot is a virtual machine aimed at running all dynamic
   languages.

 Rat Creature #1: Comrade! We are about to feast! Quick, get your fat
 carcass behind this bush and get ready!

 Rat Creature #1: Hello, small mammal Could you step in here for
 a moment? I've got something to show you

 Fone Bone: Can't you show me out here, where I've got runnin' space?

 Rat Creature #1: No! No! Please! Step in here -- your friend the
 dragon isn't around, is he?

 Fone Bone: Hey, Ted! Where you goin'?

 Ted: You're on yer own, Bone! (exit stage left)

 Rat Creature #1: Quick, comrade! Start the cooking fire!

 Rat Creature #2: No. You called me fat.

 Fone Bone: Ted! Wait for me!

 Rat Creature #1: (pulls Bone into the bush) Well, well... Look who's
 joined us for supper... Go start the cooking fire!!

 Rat Creature #2: No. You called me fat.

 Rat Creature #1: No?!!! What do you mean, no?!!!

 Rat Creature #2: And it's not the first time you've done it
 either

 Rat Creature #1: Comrade... be reasonable! I wasn't thinking -- I
 was trying to catch our dinner -- this isn't the time -- I take it
 back you're not fat.

 Rat Creature #2: Too late!

 Rat Creature #1: Please, comrade! I just want to chop him up for the
 stew!

 Rat Creature #2: And that's another thing. I'm tired of stew! I want
 to put him in a crust and bake a light fluffy quiche!

 Rat Creature #1: Quiche?! What kind of food is that for a monster to
 eat?!  Listen, do you think you could come back in half an hour?
 We'll have this straightened out by then!

 Bone: (runs away)

 Rat Creature #1: (beat) Why didn't you stop me?

 Rat Creature #2: Why should I? You're so smart!

 time passes

 Fone Bone: (hanging from a branch in a waterfall) Those rat
 creatures would have to be pretty stupid to follow me on to this
 frail, little branch!

 Rat Creatures: (follow Bone on to the frail, little branch)

 Fone Bone: Stupid, stupid rat creatures!! (branch breaks)

 -- Bone, by Jeff Smith

   Parrot 0.8.1 is available via CPAN (soon [2]). You may also see the Parrot
   download instructions[3]. For those who would like to develop on Parrot, or
   help develop Parrot itself, we recommend using Subversion [4] on our source
   code repository [5] to get the latest and best Parrot code.

   Please note the updated Parrot Roadmap [6] and our goals leading to the 1.0
   release.

   Parrot 0.8.1 News:
- Implementation
  + added CPAN module Storable 2.12 as a configuration and build dependency
  + removed the pseudo PIR opcode 'addr'
  + added the 'box' opcode
  + fixed 'pop_eh' handling in PIR libraries and examples
  + removed usage of .return for tailcalls (use .tailcall instead)
  + removed 'get_hash' and 'get_array' from Capture PMC and Capture_PIR
  + improved debugger and HLL coordination
  + allowed MMD primitive autoboxing
  + fixed all known memory leaks in PIR Hello, world!
  + NCI signatures now JITted on x86-32 platforms (Windows and Linux)
  + made the .const directive take a quoted type name instead of a constant
  + made IMCC more re-entrant
- Languages
  + Rakudo
- refactored Junctions implementation
- added fire and forget tool to rebase/rebuild/test Parrot and Rakudo
- updated container/reference semantics
- added more builtin methods and functions
- improved support for multilevel namespaces
- added support for .Str, .succ, .pred in user-defined classes
- implemented pointy blocks on if/loops
- increased STD.pm convergence
- added %*VM hash
- improved MMD candidate sorting
- improved integration of Num and Int
- implemented increment on protoobjects
- added initial support for MAIN subs
- added .PARROT method
  + Pipp
- added some predefined constants.
- added implemention of the function basename().
  + Cardinal (Ruby)
- Added initial support for the classes Proc, Continuation, Queue, Dir, 
File
, and FileStat
- fixed various minor bugs
- fixed broken Regexes
- Compilers
  + PCT
- added '.isa' method to PCT::Node
- cleaned up 'immediate block' handling
- allowed arguments to immediate blocks in loops/conditionals
- metaclass objects can now 'add_method'
  + PIRC
- integrated macro processing in PIRC's lexer
- integrated heredoc lexer in PIRC executable
- added preprocess and heredoc-preprocess commandline options
- integrated the PASM grammar into PIRC
- added a register allocator to optimize the built-in vanilla allocator
- code cleanups and documentation
- added 'make test' target
   + TGE
- updated to work with new namespace/classname syntax
- Deprecations
  + PARROT_API will become PARROT_EXPORT
  + :lexid will become :subid
- Miscellaneous
  + Documentation
  

Assignment of UnManagedStruct in Perl6

2008-11-18 Thread Simon Cozens
I'm writing an SQLite extension. I have it working fine in PIR, but the
bridge to Perl 6 is causing problems. Specifically, this Perl 6 code works:

SQLite::pmc_check(SQLite::open(test.db));
# Returning 0x2d1efa0
# PMC 0xedf1a8 data pointer 0x2d1efa0
# PMC 0xedf1a8 data pointer 0x2d1efa0

But this code does not:

our $db; SQLite::pmc_check($db = SQLite::open(test.db));
# Returning 0x2d1a850
# PMC 0x263f504 data pointer 0x2d1a850
# PMC 0x263f590 data pointer 0x0

SQLite::open is implemented in PIR, as follows:

.sub open
.local pmc x
x = open_wrapper(test.db)
pmc_check(x)
.return(x)
.end

pmc_check is a simple C function to tell me what's going on inside my
UnManagedStruct:

void pmc_check(PMC* pmc) {
printf(PMC %p data pointer %p\n, pmc, pmc-data);
}

The difference is, of course, that it goes through a Perl 6 variable
assignment.

From this I can conclude that my PIR open() code correctly returns an
UnManagedStruct PMC; however, when Perl 6's assignment operator assigns
this to a variable, a new, empty UnManagedStruct PMC is created and no
longer contains the right data.

I have no idea how to fix this, but it looks like the assignment
operator is broken.

Simon