[perl #43424] [TODO] pdd15 objects documentation incorrect (callmethod)

2007-06-29 Thread via RT
# New Ticket Created by  Sandy Bultena 
# Please include the string:  [perl #43424]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43424 





The documentation in pdd15_objects.html referring to callmethod and 
callmethodcc state that only the method name is required as a parameter, 
however the tests (in objects_meth.t) appear to indicate that the 1st parameter 
is the class (or object??) and then the the second parameter is the name of the 
method.Documentation is:callmethod
  callmethod  callmethod $S1

Call a method. If the method name is provided in $S1, we find the
PMC for the named method and put it in the sub/method slot. If no name
is provided we assume that all the calling conventions have already
been set up and the method PMC is already in the proper place.

callmethodcc
  callmethodcc  callmethodcc $S1

Make a method call, automatically generating a return continuation.
If a method name is passed in we look up the method PMC for the object
and put it in the method slot. If a method name isn't provided then we
assume that things are already properly set up.

Test Case Is:pasm_error_output_like( 'CODE', 'OUTPUT', callmethod (STR) - 
unknown method );newpdd15class P2, Fooset S1, nadacallmethod 
P2, S1, P1print nope\nendCODE/Method 'nada' not 
found/OUTPUTpasm_error_output_like( 'CODE', 'OUTPUT', callmethodcc - 
unknown method );newpdd15class P2, Fooset S0, nadacallmethodcc 
P2, S0print nope\nendCODE/Method 'nada' not found/OUTPUT
_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us

[perl #43423] [TODO] missing tests for pdd15oo

2007-06-29 Thread Todd Rinaldo
# New Ticket Created by  Todd Rinaldo 
# Please include the string:  [perl #43423]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43423 


While comparing pdd15_objects compared to the tests located in t/pdd15oo we 
cannot find evidence the following tests exist: 
callmethodsupercc
callmethodnextcc
newclass
get_class
removeparent
removeattribute
addrole


[perl #43431] build problem

2007-06-29 Thread via RT
# New Ticket Created by  Richard Hainsworth 
# Please include the string:  [perl #43431]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43431 


Dear Parrot people,

Just updates my subversion depository after a long time.

Got this error after 'make'
...
make -C compilers/past-pm
make[1]: Entering directory 
`/home/richard/development/parrot/trunk/compilers/past-pm'
/usr/bin/perl -MExtUtils::Command -e rm_rf PAST-pm.pbc 
../../runtime/parrot/library/PAST-pm.pbc
../../parrot ../../compilers/tge/tgc.pir --output=POST/Grammar_gen.pir 
POST/Grammar.tg
PackFile_unpack: Bytecode not valid for this interpreter: fingerprint 
mismatch
Parrot VM: Can't unpack packfile 
/home/richard/development/parrot/trunk/./compilers/tge/TGE/Parser.pbc.
Null PMC access in invoke()
current instr.: 'parrot;TGE::Compiler;parse_grammar' pc 28 
(TGE/Compiler.pir:34)
called from Sub 'parrot;TGE::Compiler;precompile' pc 654 
(TGE/Compiler.pir:293)
called from Sub 'main' pc 101 (../../compilers/tge/tgc.pir:87)
make[1]: *** [PAST-pm.pbc] Error 1
make[1]: Leaving directory 
`/home/richard/development/parrot/trunk/compilers/past-pm'
make: *** [compilers.dummy] Error 2

myconfig is

Summary of my parrot 0.4.13 (r19455) configuration:
  configdate='Fri Jun 29 08:27:29 2007 GMT'
  Platform:
osname=linux, archname=i486-linux-gnu-thread-multi
jitcapable=1, jitarchname=i386-linux,
jitosname=LINUX, jitcpuarch=i386
execcapable=1
perl=/usr/bin/perl
  Compiler:
cc='cc', ccflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-DDEBIAN  -pipe -I/usr/local/include -D_
LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  Linker and Libraries:
ld='cc', ldflags=' -L/usr/local/lib',
cc_ldflags='',
libs='-ldl -lm -lpthread -lcrypt -lrt -lgmp -lreadline -lncurses'
  Dynamic Linking:
share_ext='.so', ld_share_flags='-shared -L/usr/local/lib -fPIC',
load_ext='.so', ld_load_flags='-shared -L/usr/local/lib -fPIC'
  Types:
iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4,
ptrsize=4, ptr_alignment=1 byteorder=1234,
nv=double, numvalsize=8, doublesize=8


Regards,
Richard


[perl #43432] [PATCH] Destroy condition before freeing memory

2007-06-29 Thread via RT
# New Ticket Created by  Ron Blaschke 
# Please include the string:  [perl #43432]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43432 


See subject.

Changed Files:
src/thread.c

Ron
Index: src/thread.c
===
--- src/thread.c(revision 19310)
+++ src/thread.c(working copy)
@@ -1175,8 +1175,10 @@
 size_t  i;
 Shared_gc_info *info = get_pool(interp);
 
-if (info)
+if (info) {
+COND_DESTROY(info-gc_cond);
 mem_sys_free(info);
+}
 
 /*
  * if no threads were started - fine


parrot as a vm for real processors

2007-06-29 Thread pancake
yesterday i was thinking about a way for interpretting assembly code of ARM
(and maybe other architectures) while defining a grammar for its assembly.

This way it will be possible to embed parrot on a debugger and let't interact
between the code and the debugger implementing in this way a pseudo-assembly-
language for multiple architectures.

The only thing that will be needed is the hardware interaction that can be
extended with libraries and so, but atm i'm just interested on interpretting
a sequence of opcodes and emulate them. Registers can be directly mapped into
parrot registers and atm i'm only thinking on supporting text-based assembly,
binary one can be added later.

Here my questions: 

I think it would be rather simple to do it, but i don't have the skills yet
for doing it. What's the 'easiest' language to start working on as a template?

It is possible to define a binary grammar or i should write a parser for it
in pure parrot and passing this code to a function that interprets a one
line of assembly code.

Should be better to implement everything in parrot instead of using a grammar?

PD: I was trying to implement some hooks on the exception layer, but I saw
that the interface it's not yet defined and I'll wait for it to continue this
work.

Thanks!

  --pancake


[perl #43422] [EMAIL PROTECTED],[EMAIL PROTECTED]

2007-06-29 Thread Todd Rinaldo
# New Ticket Created by  Todd Rinaldo 
# Please include the string:  [perl #43422]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43422 


Hello. reviewing object-meths.t, we noticed that in some tests with 
callmethod in them actually are testing callmethodcc and vice-versa. This 
attached patch file documents the changes we were able to notice.


object-meths.t.patch
Description: Binary data


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

2007-06-29 Thread pmichaud
Author: pmichaud
Date: Fri Jun 29 07:07:20 2007
New Revision: 19464

Modified:
   trunk/docs/pdds/pdd23_exceptions.pod

Log:
[docs]:
* The phrase 'may not' is sometimes confusing.


Modified: trunk/docs/pdds/pdd23_exceptions.pod
==
--- trunk/docs/pdds/pdd23_exceptions.pod(original)
+++ trunk/docs/pdds/pdd23_exceptions.podFri Jun 29 07:07:20 2007
@@ -213,8 +213,8 @@
 =item BPMC *get_message()
 
 Get an exception's human-readable self-description.  Note that the type of the
-returned PMC may not be CString, but you should still be able to stringify
-and print it.
+returned PMC isn't required to be CString, but you should still be able 
+to stringify and print it.
 
 =item BPMC *get_payload()
 


Re: [perl #43431] build problem

2007-06-29 Thread Paul Cochrane

On 29/06/07, via RT Richard Hainsworth
[EMAIL PROTECTED] wrote:

# New Ticket Created by  Richard Hainsworth
# Please include the string:  [perl #43431]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43431 


Dear Parrot people,

Just updates my subversion depository after a long time.

Got this error after 'make'
...
make -C compilers/past-pm
make[1]: Entering directory
`/home/richard/development/parrot/trunk/compilers/past-pm'
/usr/bin/perl -MExtUtils::Command -e rm_rf PAST-pm.pbc
../../runtime/parrot/library/PAST-pm.pbc
../../parrot ../../compilers/tge/tgc.pir --output=POST/Grammar_gen.pir
POST/Grammar.tg
PackFile_unpack: Bytecode not valid for this interpreter: fingerprint
mismatch
Parrot VM: Can't unpack packfile
/home/richard/development/parrot/trunk/./compilers/tge/TGE/Parser.pbc.
Null PMC access in invoke()
current instr.: 'parrot;TGE::Compiler;parse_grammar' pc 28
(TGE/Compiler.pir:34)
called from Sub 'parrot;TGE::Compiler;precompile' pc 654
(TGE/Compiler.pir:293)
called from Sub 'main' pc 101 (../../compilers/tge/tgc.pir:87)
make[1]: *** [PAST-pm.pbc] Error 1


Did you do a make realclean  perl Configure.pl after svn up?  This could help.

Paul


[perl #43342] [TODO] config/init/miniparrot.pm: Write unit tests

2007-06-29 Thread James Keenan via RT
There was code in several of the test files in the reconfigure/ branch which 
was repeated.  At 
the hackathon, David Adler refactored it into a subroutine which I then placed 
in new file 
Auxiliary.pm.  That file is contained in this patch along with a revised 
t/104-init_miniparrot.t 
and appropriate MANIFEST revisions.

Please review.  Thank you very much.
kid51
Index: MANIFEST
===
--- MANIFEST(revision 19464)
+++ MANIFEST(working copy)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Jun 28 21:14:19 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Jun 29 14:51:05 2007 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2862,6 +2862,7 @@
 t/configure/config_steps.t  []
 t/configure/data.t  []
 t/configure/step.t  []
+t/configure/testlib/Auxiliary.pm[]
 t/configure/testlib/Make_VERSION_File.pm[]
 t/configure/testlib/init/alpha.pm   []
 t/configure/testlib/init/beta.pm[]
Index: MANIFEST.SKIP
===
--- MANIFEST.SKIP   (revision 19464)
+++ MANIFEST.SKIP   (working copy)
@@ -1,6 +1,6 @@
 # ex: set ro:
 # $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Jun 28 20:58:24 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Jun 29 14:51:05 2007 UT
 #
 # This file should contain a transcript of the svn:ignore properties
 # of the directories in the Parrot subversion repository. (Needed for
Index: t/configure/104-init_miniparrot.t
===
--- t/configure/104-init_miniparrot.t   (revision 19464)
+++ t/configure/104-init_miniparrot.t   (working copy)
@@ -7,20 +7,14 @@
 use warnings;
 use Test::More tests = 22;
 use Carp;
-use lib qw( . lib ../lib ../../lib );
+use lib qw( . lib ../lib ../../lib t/configure/testlib );
 use_ok('config::init::defaults');
 use_ok('config::init::miniparrot');
 use Parrot::BuildUtil;
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
+use Auxiliary qw( test_step_thru_runstep);
 
-=for hints_for_testing This file ought to test what happens when you
-first create a Parrot::Configure object, populate it with default
-settings as in init::defaults, then override those settings per
-init::miniparrot.
-
-=cut
-
 my $parrot_version = Parrot::BuildUtil::parrot_version();
 my $args = process_options( {
 argv= [ q{--miniparrot} ],
@@ -31,23 +25,8 @@
 
 my $conf = Parrot::Configure-new;
 
-my ($pkg, $task, $step_name, @step_params, $step, $ret);
+test_step_thru_runstep($conf, q{init::defaults}, $args, 0);
 
-$pkg = q{init::defaults};
-$conf-add_steps($pkg);
-$conf-options-set(%{$args});
-
-$task = $conf-steps-[0];
-$step_name   = $task-step;
[EMAIL PROTECTED] = @{ $task-params };
-
-$step = $step_name-new();
-ok(defined $step, $step_name constructor returned defined value);
-isa_ok($step, $step_name);
-ok($step-description(), $step_name has description);
-$ret = $step-runstep($conf);
-ok(defined $ret, $step_name runstep() returned defined value);
-
 is($conf-data-get('miniparrot'), undef,
 miniparrot is not yet enabled);
 is($conf-data-get('jitarchname'), undef,
@@ -59,23 +38,8 @@
 is($conf-data-get('jitosname'), undef,
 jitosname undef as expected);
 
+test_step_thru_runstep($conf, q{init::miniparrot}, $args, 1);
 
-$pkg = q{init::miniparrot};
-
-$conf-add_steps($pkg);
-$conf-options-set(%{$args});
-
-$task = $conf-steps-[1];
-$step_name   = $task-step;
[EMAIL PROTECTED] = @{ $task-params };
-
-$step = $step_name-new();
-ok(defined $step, $step_name constructor returned defined value);
-isa_ok($step, $step_name);
-ok($step-description(), $step_name has description);
-$ret = $step-runstep($conf);
-ok(defined $ret, $step_name runstep() returned defined value);
-
 ok($conf-data-get('miniparrot'),
 miniparrot is enabled);
 is($conf-data-get('jitarchname'), 'nojit',
Index: t/configure/testlib/Auxiliary.pm
===
--- t/configure/testlib/Auxiliary.pm(revision 0)
+++ t/configure/testlib/Auxiliary.pm(revision 0)
@@ -0,0 +1,89 @@
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: GenerateCore.pm 17576 2007-03-17 22:50:07Z paultcochrane $
+package Auxiliary;
+use strict;
+use warnings;
+our ( @ISA, @EXPORT_OK );
[EMAIL PROTECTED]   = qw(Exporter);
[EMAIL PROTECTED] = qw(
+test_step_thru_runstep
+);
+use Carp;
+*ok = *Test::More::ok;
+*isa_ok = *Test::More::isa_ok;
+use lib qw( . lib ../lib ../../lib );
+use Parrot::Configure;
+
+sub test_step_thru_runstep {
+my ($conf, $pkg, $args, $stepnum) = @_;
+my ($task, $step_name, @step_params, $step, 

Re: [perl #43417] Should we change the API of functions just for real_exception()?

2007-06-29 Thread Klaas-Jan Stol

On 6/29/07, via RT Paul Cochrane [EMAIL PROTECTED] wrote:


# New Ticket Created by  Paul Cochrane
# Please include the string:  [perl #43417]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43417 


Hi all,

As part of going through and converting internal_exception()s to
real_exception()s (see RT#40392) I've found several functions which
could use real_exception(), but to use this they would have to have
the interpreter passed in as an argument, hence changing their API.
Is it worth changing these functions' API just for a real_exception()?

Comments most definitely welcome!

Paul



Hi Paul
just a short thought. Apparently the exception can be caught, as it is a
real exception, not a fatal (internal) exception; thus apparently if it is
possible (if the situation is considered appropiate) to do so, then the
interpreter structure is needed, otherwise it's just not possible.
So, in other words, I think it would be well worth it to adjust the API, as
it is only a single extra argument, and it makes behaviour/expectations more
consistent and correct.

just my 2c,

kjs


Re: [perl #43342] [TODO] config/init/miniparrot.pm: Write unit tests

2007-06-29 Thread Bernhard Schmalhofer

James Keenan via RT schrieb:
There was code in several of the test files in the reconfigure/ branch which was repeated.  At 
the hackathon, David Adler refactored it into a subroutine which I then placed in new file 
Auxiliary.pm.  That file is contained in this patch along with a revised t/104-init_miniparrot.t 
and appropriate MANIFEST revisions.


Please review.  Thank you very much.
kid51
  
Reducing code redundancy is good idea. My suggestion is to call the 
packaga something
like Parrot::Test::Configure and accordingly move the file to 
lib/Parrot/Test/Configure.pm.


Regards,
 Bernhard


Re: t/codingstd/perlcritic.t needs to be optional

2007-06-29 Thread Nicholas Clark
 Modified since when?

Since the last time the user ran Configure.
(For the default test run)

I think that this will produce minimal false positives and false negatives,
for identifying which files have been locally edited.

Nicholas Clark


Should MANIFEST determine .pbc builds in runtime/parrot/library/ ?

2007-06-29 Thread Patrick R. Michaud
I just spent about an hour trying to figure out how the files
in runtime/parrot/library/ are automatically compiled into .pbc files
when Parrot is built.  It turns out that the list of files
is computed from the MANIFEST, and I was searching through
files in the config/ subdirectory (where most other configuration-like
items tend to be placed).

Is MANIFEST the correct file for determining which .pir files
should automatically be converted to .pbc ?

And if it is (or even if it isn't but we decide to keep it
this way for some time), could/should there be a note in the
generated root Makefile that indicates that GEN_LIBRARY is
being generated from entries in the MANIFEST?

Thanks,

Pm



Re: pdd15: How do I subclass a parrot; PMC class?

2007-06-29 Thread jerry gay

On 6/28/07, Patrick R. Michaud [EMAIL PROTECTED] wrote:

Another question about pdd15...:

If I'm in a different HLL namespace (e.g., via a .HLL directive), how do
I get a PMC class from the 'parrot' HLL namespace?

Here is an example (which obviously won't work):  I'm creating a
'perl6;Str' class and then attempting to add (parrot's) String class
as a parent.  But of course the constant 'String' here refers to
the wrong HLL namespace:

$ cat z.pir
.HLL perl6, 

.namespace [  ]

.sub main :main
# create 'Str' class
$P1 = new 'Class'
$P1.'name'('Str')

# add parrot;String PMC as a parent class
$P2 = get_class 'String'
addparent $P1, $P2
.end

$ ./parrot z.pir
Class 'String' doesn't exist
current instr.: 'perl6;;main' pc 12 (z.pir:11)
$

Of course, I'm mostly interested in knowing what the answer should be, but I'm
also interested in what works today.


i've tried attacking this from a number of directions with current
functionality, and can't seem to get anything to work.

note that this example only works if *both* the .HLL and .namespace
lines are commented out. i can't quite figure out why that is, but
i'll to stare at the C source a bit and see if something jumps out.

~jerry


Re: pdd15: How do I subclass a parrot; PMC class?

2007-06-29 Thread Patrick R. Michaud
On Fri, Jun 29, 2007 at 11:23:46AM -0700, jerry gay wrote:
 On 6/28/07, Patrick R. Michaud [EMAIL PROTECTED] wrote:
 Another question about pdd15...:
 
 If I'm in a different HLL namespace (e.g., via a .HLL directive), how do
 I get a PMC class from the 'parrot' HLL namespace?
 
 Here is an example (which obviously won't work):  I'm creating a
 'perl6;Str' class and then attempting to add (parrot's) String class
 as a parent.  But of course the constant 'String' here refers to
 the wrong HLL namespace:
 
 $ cat z.pir
 .HLL perl6, 
 
 .namespace [  ]
 
 .sub main :main
 # create 'Str' class
 $P1 = new 'Class'
 $P1.'name'('Str')
 
 # add parrot;String PMC as a parent class
 $P2 = get_class 'String'
 addparent $P1, $P2
 .end
 
 $ ./parrot z.pir
 Class 'String' doesn't exist
 current instr.: 'perl6;;main' pc 12 (z.pir:11)
 $
 
 Of course, I'm mostly interested in knowing what the answer should be, 
 but I'm
 also interested in what works today.
 
 i've tried attacking this from a number of directions with current
 functionality, and can't seem to get anything to work.
 
 note that this example only works if *both* the .HLL and .namespace
 lines are commented out. i can't quite figure out why that is, but
 i'll to stare at the C source a bit and see if something jumps out.

I think this is a case where the spec simply doesn't cover the needed
behavior yet, not that the implementation is missing something.

If I use C get_class String  in a HLL other than parrot, 
then I somewhat expect the behavior we're already seeing.  In
other words, we're asking for a String class in the current
(HLL) namespace, and there isn't one, and thus we get an
exception.

So, the question is -- how do we locate PMC classes in other
HLL namespaces?

Pm


DISREGARD: Should MANIFEST determine .pbc builds in runtime/parrot/library/ ?

2007-06-29 Thread Patrick R. Michaud
On Fri, Jun 29, 2007 at 11:55:28AM -0500, Patrick R. Michaud wrote:
 I just spent about an hour trying to figure out how the files
 in runtime/parrot/library/ are automatically compiled into .pbc files
 when Parrot is built.  It turns out that the list of files
 is computed from the MANIFEST, and I was searching through
 files in the config/ subdirectory (where most other configuration-like
 items tend to be placed).

Never mind, I finally figured it out.  It's in config/gen/makefiles/root.in .

I was doing ack HLLCompiler in the config directory (and other directories)
to try to find the HLLCompiler.pbc target, but didn't realize that ack
doesn't search root.in by default.  I guess this is one of those
1% cases where I should've used grep -r instead, or learned about
ack -a.

Pm


[perl #43417] Should we change the API of functions just for real_exception()?

2007-06-29 Thread Bob Rogers
   From: Paul Cochrane (via RT) [EMAIL PROTECTED]
   Date: Thu, 28 Jun 2007 11:06:47 -0700

   # New Ticket Created by  Paul Cochrane 
   # Please include the string:  [perl #43417]
   # in the subject line of all future correspondence about this issue. 
   # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43417 

   Hi all,

   As part of going through and converting internal_exception()s to
   real_exception()s (see RT#40392) I've found several functions which
   could use real_exception(), but to use this they would have to have
   the interpreter passed in as an argument, hence changing their API.
   Is it worth changing these functions' API just for a real_exception()?

   Comments most definitely welcome!

   Paul

As far as I'm concerned, the only places where we should keep
internal_exception are those where throwing an exception would just make
it worse, e.g. when deep memory corruption is detected and throwing is
so likely to fail that it would only obscure the source of the error.
I've been converting calls to use real_exception one at a time, because
I needed to see the backtrace to debug something else; that alone, IMHO,
is worth API changes.  Using real_exception will become even more
helpful as code gets more complicated and interactive debugging becomes
more powerful.

   So my vote is a resounding YES!

   If you would like to pass some or all of these cases on to me, please
do; just let me know, so I'm not stepping on your toes.

-- Bob Rogers
   http://rgrjr.dyndns.org/


Re: t/codingstd/perlcritic.t needs to be optional

2007-06-29 Thread Patrick R. Michaud
On Fri, Jun 29, 2007 at 05:59:38PM +0100, Nicholas Clark wrote:
  Modified since when?
 
 Since the last time the user ran Configure.
 (For the default test run)
 
 I think that this will produce minimal false positives and false negatives,
 for identifying which files have been locally edited.

This might work for others -- it probably wouldn't help me.

I tend to run make realclean; perl Configure.pl; before doing a
make test prior to checkin... just to make sure I'm working from
something clean.  So, checking files modified since configure would
tend to miss the files I just changed.

Pm


Re: pdd15: How do I subclass a parrot; PMC class?

2007-06-29 Thread jerry gay

On 6/29/07, Patrick R. Michaud [EMAIL PROTECTED] wrote:

On Fri, Jun 29, 2007 at 11:23:46AM -0700, jerry gay wrote:
 On 6/28/07, Patrick R. Michaud [EMAIL PROTECTED] wrote:
 Another question about pdd15...:
 
 If I'm in a different HLL namespace (e.g., via a .HLL directive), how do
 I get a PMC class from the 'parrot' HLL namespace?
 
 Here is an example (which obviously won't work):  I'm creating a
 'perl6;Str' class and then attempting to add (parrot's) String class
 as a parent.  But of course the constant 'String' here refers to
 the wrong HLL namespace:
 
 $ cat z.pir
 .HLL perl6, 
 
 .namespace [  ]
 
 .sub main :main
 # create 'Str' class
 $P1 = new 'Class'
 $P1.'name'('Str')
 
 # add parrot;String PMC as a parent class
 $P2 = get_class 'String'
 addparent $P1, $P2
 .end
 
 $ ./parrot z.pir
 Class 'String' doesn't exist
 current instr.: 'perl6;;main' pc 12 (z.pir:11)
 $
 
 Of course, I'm mostly interested in knowing what the answer should be,
 but I'm
 also interested in what works today.
 
 i've tried attacking this from a number of directions with current
 functionality, and can't seem to get anything to work.

 note that this example only works if *both* the .HLL and .namespace
 lines are commented out. i can't quite figure out why that is, but
 i'll to stare at the C source a bit and see if something jumps out.

I think this is a case where the spec simply doesn't cover the needed
behavior yet, not that the implementation is missing something.

If I use C get_class String  in a HLL other than parrot,
then I somewhat expect the behavior we're already seeing.  In
other words, we're asking for a String class in the current
(HLL) namespace, and there isn't one, and thus we get an
exception.

So, the question is -- how do we locate PMC classes in other
HLL namespaces?


the get_class opcode takes a NameSpace PMC or a String, as per
src/ops/object.ops:


 =item Bget_class(out PMC, in STR)

 =item Bget_class(out PMC, in PMC)

 Find the PMC for a class, by string name or by key.

 =cut

mind you, the documentation could be a bit more specific, but i expect
that passing it a NameSpace PMC relative to the root namespace should
work. i haven't been able to get it to work--but i'd be happy to be
proven wrong.
~jerry


Re: pdd15: How do I subclass a parrot; PMC class?

2007-06-29 Thread Patrick R. Michaud
On Fri, Jun 29, 2007 at 11:45:18AM -0700, jerry gay wrote:
 On 6/29/07, Patrick R. Michaud [EMAIL PROTECTED] wrote:
 On Fri, Jun 29, 2007 at 11:23:46AM -0700, jerry gay wrote:
  On 6/28/07, Patrick R. Michaud [EMAIL PROTECTED] wrote:
  .HLL perl6, 
  ...
  $P2 = get_class 'String'
  ...
  $ ./parrot z.pir
  Class 'String' doesn't exist
  current instr.: 'perl6;;main' pc 12 (z.pir:11)
  $
  
 
 I think this is a case where the spec simply doesn't cover the needed
 behavior yet, not that the implementation is missing something.
 
 If I use C get_class String  in a HLL other than parrot,
 then I somewhat expect the behavior we're already seeing.  In
 other words, we're asking for a String class in the current
 (HLL) namespace, and there isn't one, and thus we get an
 exception.

 the get_class opcode takes a NameSpace PMC or a String, as per
 src/ops/object.ops:
 
  =item Bget_class(out PMC, in STR)
 
  =item Bget_class(out PMC, in PMC)
 
  Find the PMC for a class, by string name or by key.
 
  =cut
 
 mind you, the documentation could be a bit more specific, but i expect
 that passing it a NameSpace PMC relative to the root namespace should
 work. 

This presumes that every PMC class also has a Namespace PMC associated
with it that points to the class.  I'm not sure that's true for 
Parrot PMC classes.

Pm


Re: t/codingstd/perlcritic.t needs to be optional

2007-06-29 Thread Bob Rogers
   From: Patrick R. Michaud [EMAIL PROTECTED]
   Date: Fri, 29 Jun 2007 13:42:18 -0500

   On Fri, Jun 29, 2007 at 05:59:38PM +0100, Nicholas Clark wrote:
 Modified since when?

Since the last time the user ran Configure.
(For the default test run)

I think that this will produce minimal false positives and false negatives,
for identifying which files have been locally edited.

   This might work for others -- it probably wouldn't help me.

   I tend to run make realclean; perl Configure.pl; before doing a
   make test prior to checkin...

I do pretty much the same thing, come to think of it.  How about a dummy
perlcritic-timestamp file that gets touched as the last step of
Configure.pl (and not walloped by make realclean), so that there is a
single place to reset?  Or maybe it should be touched only if it doesn't
already exist, and we can delete it when the load creeps up?

-- Bob Rogers
   http://rgrjr.dyndns.org/


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

2007-06-29 Thread allison
Author: allison
Date: Fri Jun 29 10:33:22 2007
New Revision: 19479

Modified:
   trunk/docs/pdds/pdd15_objects.pod

Log:
[pdd15] Adding 'new' opcode to OO PDD.


Modified: trunk/docs/pdds/pdd15_objects.pod
==
--- trunk/docs/pdds/pdd15_objects.pod   (original)
+++ trunk/docs/pdds/pdd15_objects.pod   Fri Jun 29 10:33:22 2007
@@ -972,6 +972,17 @@
 in that namespace object. A key looks for the class in the namespace identified
 by the multilevel key relative to the currently selected HLL.
 
+=item new
+
+  $P1 = new $S2
+  $P1 = new $S2, $P3
+  $P1 = new $P2
+  $P1 = new $P2, $P3
+
+Create a new object from the class named by $S2 or $P2 (a string PMC, namespace
+key, or class object), and put the PMC for it in $P1. You may optionally pass a
+hash of initialization parameters for the class in $P3.
+
 =item addparent
 
   addparent $P1, $P2


[perl #43438] [PATCH][Win32] Update Win32 stat

2007-06-29 Thread via RT
# New Ticket Created by  Ron Blaschke 
# Please include the string:  [perl #43438]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43438 


Attached patch steal the basic layout from
Fconfig/gen/platform/generic/stat.c and makes the
Ft/pmc/io.t stat failed test work.

Changed Files:
config/gen/platform/win32/stat.c
t/pmc/io.t

Tested on:

Visual C++ 8.0
$ runtests t\pmc\io.t
t\pmc\io..ok
All tests successful.

Test Summary Report
---
t\pmc\io.t (Wstat: 0 Tests: 45 Failed: 0)
  Tests skipped: 8
Files=1, Tests=45,  3 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)


Visual C++ 7.1
$ runtests t\pmc\io.t
t\pmc\io..ok
All tests successful.

Test Summary Report
---
t\pmc\io.t (Wstat: 0 Tests: 45 Failed: 0)
  Tests skipped: 8
Files=1, Tests=45,  3 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)


MinGW GCC 3.4.2
$ runtests t\pmc\io.t
t\pmc\io..ok
All tests successful.

Test Summary Report
---
t\pmc\io.t (Wstat: 0 Tests: 45 Failed: 0)
  Tests skipped: 8
Files=1, Tests=45,  6 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)

Ron
Index: config/gen/platform/win32/stat.c
===
--- config/gen/platform/win32/stat.c(revision 19421)
+++ config/gen/platform/win32/stat.c(working copy)
@@ -2,173 +2,145 @@
  * File stat stuff
  */
 
+static INTVAL
+stat_common(Interp *interpreter, struct _stat *statbuf,
+INTVAL thing, int status)
+{
+INTVAL result;
+
+if (thing == STAT_EXISTS)
+return status == 0;
+if (status == -1) {
+const char *err = strerror(errno);
+real_exception(interpreter, NULL, E_IOError,
+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_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:
+internal_exception(1, STAT_PLATFORM_BLOCKSIZE not supported);
+break;
+
+case STAT_PLATFORM_BLOCKS:
+internal_exception(1, STAT_PLATFORM_BLOCKS not supported);
+break;
+
+default:
+result = -1;
+}
+
+return result;
+}
+
 PMC *
 Parrot_stat_file(Parrot_Interp interpreter, STRING *filename)
 {
-  return NULL;
+return NULL;
 }
 
 PMC *
 Parrot_stat_info_pmc(Parrot_Interp interpreter, STRING *filename, INTVAL thing)
 {
-  return NULL;
+return NULL;
 }
 
 INTVAL
 Parrot_stat_info_intval(Parrot_Interp interpreter, STRING *file, INTVAL thing)
 {
-  struct stat statbuf;
-  char *filename;
-  INTVAL result = -1;
-  int status;
+struct _stat statbuf;
+char *filename;
+int status;
 
-  /* Get the name of the file as something we can use */
-  filename = string_to_cstring(interpreter, file);
+/* Get the name of the file as something we can use */
+filename = string_to_cstring(interpreter, file);
 
-  /* Everything needs the result of stat, so just go do it */
-  status = stat(filename, statbuf);
-
-  switch (thing) {
-  case STAT_EXISTS:
-result = (status == 0);
-break;
-  case STAT_FILESIZE:
-result = statbuf.st_size;
-break;
-  case STAT_ISDIR:
-result = S_ISDIR(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 

Macros that assume variables are awful

2007-06-29 Thread Andy Lester


The PANIC() macro used to look like this

  #define PANIC(message) do_panic(interp, message, __FILE__, __LINE__)

Note how it assumes that we have an interp in scope.  But what do  
we do in src/gc/malloc.c?  When we don't have an interp and want to  
pass NULL to do_panic?


Of course!  We #define interp NULL!

G

xoxo,
Andy

--
Andy Lester = [EMAIL PROTECTED] = www.petdance.com = AIM:petdance






Re: [perl #43342] [TODO] config/init/miniparrot.pm: Write unit tests

2007-06-29 Thread James Keenan


On Jun 29, 2007, at 12:28 PM, Bernhard Schmalhofer via RT wrote:


James Keenan via RT schrieb:
There was code in several of the test files in the reconfigure/  
branch which was repeated.  At
the hackathon, David Adler refactored it into a subroutine which I  
then placed in new file
Auxiliary.pm.  That file is contained in this patch along with a  
revised t/104-init_miniparrot.t

and appropriate MANIFEST revisions.

Please review.  Thank you very much.
kid51


Reducing code redundancy is good idea. My suggestion is to call the
packaga something
like Parrot::Test::Configure and accordingly move the file to
lib/Parrot/Test/Configure.pm.



Okay.  Let's hold this patch for the time being.  In the reconfigure/  
branch we're working our way through 56 configuration steps and 56  
corresponding RT tickets.  Chances are good that we'll develop some  
additional subroutines for shortcuts in testing.  We'll see what  
develops as the best way to package these up, then submit a more  
refined module to trunk.


kid51


[perl #43444] 'make' error: No rule to make target `src/path.str'

2007-06-29 Thread via RT
# New Ticket Created by  James Keenan 
# Please include the string:  [perl #43444]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43444 


---
osname= linux
osvers= 2.6.15
arch=   i386-linux-thread-multi
cc= cc
---
Flags:
category=core
severity=critical
ack=no
---
This error occurred yesterday and somehow got fixed.  Now it is
re-occuring.  The problem has two major symptoms:
1.  'make' stops dead at this point:

/usr/local/bin/perl tools/build/c2str.pl src/builtin.c  src/builtin.str
/usr/local/bin/perl tools/build/c2str.pl src/global.c  src/global.str
/usr/local/bin/perl tools/build/c2str.pl src/library.c  src/library.str
make: *** No rule to make target `src/path.str', needed by 
`src/string_private_cstring.h'.  Stop.

2.  This file, config_lib.pasm, gets deposited in my top-level trunk directory.
# Generated by config/gen/config_pm.pm from the template
# 'config/gen/config_pm/config_lib.in' and %PConfig
# This file should be the last thing run during
# the make process, after Parrot is built.
.pcc_sub main:
get_params (0), P5
set I10, P5 # argv
set I11, 0  # flag
le I10, 1, no_arg
set S10, P5[1]
ne S10, --install, no_arg
set I11, 1  # install flag
no_arg:
new P0, .Hash
new P1, .Undef

set P0[a], .a
set P0[aio], define
set P0[ar], ar
set P0[ar_extra], 
set P0[ar_flags], cr
set P0[ar_out], 
set P0[archname], i686-linux
set P0[as], as
set P0[asmfun_o], 
set P0[bigendian], 0
set P0[bin_dir], /usr/local/bin
set P0[bindir], /usr/local/bin
set P0[bison_version], P1
set P0[blib_dir], blib/lib
set P0[build_dir], /home/jimk/work/parrot
set P0[byteorder], 1234
set P0[cc], cc
set P0[cc_debug], -g
set P0[cc_exe_out], -o 
set P0[cc_hasjit],  -DHAS_JIT -DI386
set P0[cc_inc], -I./include
set P0[cc_ldflags], 
set P0[cc_o_out], -o 
set P0[cc_shared], -fpic -fPIC
set P0[ccflags],  -pipe -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
set P0[ccwarn],  -W -Wall -Wstrict-prototypes -Wmissing-prototypes 
-Winline -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings 
-Waggregate-return -Winline -Wno-unused -Wsign-compare -falign-functions=16 
-Wformat-nonliteral -Wformat-security -Wpacked -Wdisabled-optimization 
-mno-accumulate-outgoing-args -Wno-shadow 
set P0[cg_flag], -DHAVE_COMPUTED_GOTO
set P0[charset], ascii.c binary.c iso-8859-1.c tables.c unicode.c
set P0[chmod], $(PERL) -MExtUtils::Command -e ExtUtils::Command::chmod
set P0[configdate], Sat Jun 30 03:34:46 2007 GMT
set P0[cp], $(PERL) -MExtUtils::Command -e cp
set P0[cpuarch], i386
set P0[cxx], c++
set P0[D_SIGRTMAX], 64
set P0[D_SIGRTMIN], 33
set P0[datadir], /usr/local/share
set P0[debugging], 1
set P0[DEVEL], -devel
set P0[doc_dir], /usr/local/share/doc/parrot
set P0[doublesize], 8
set P0[dquote], \\\
set P0[encoding], fixed_8.c ucs2.c utf16.c utf8.c
set P0[exe], 
set P0[exec_prefix], /usr/local
set P0[execcapable], 1
set P0[flex_version], P1
set P0[float4_t], float
set P0[float8_t], double
set P0[floatsize], 4
set P0[floatvalfmt], %f
set P0[gc_flag], 
set P0[gccversion], 3.3
set P0[gmake_version], 3.80
set P0[has___sighandler_t], define
set P0[HAS_AIO], 1
set P0[HAS_aligned_funcptr], 1
set P0[HAS_C99_SNPRINTF], 1
set P0[has_dynamic_linking], 1
set P0[has_gdbm], 1
set P0[has_gnu_m4], 1
set P0[HAS_i386_gcc_cmpxchg], 1
set P0[HAS_i386_mmx], 1
set P0[HAS_i386_sse], 1
set P0[has_icu], 0
set P0[has_perldoc], 1
set P0[has_python], 1
set P0[has_python_2_4], 0
set P0[has_setitimer], define
set P0[has_sig_atomic_t], define
set P0[has_sigaction], define
set P0[has_sigatomic_t], P1
set P0[HAS_SNPRINTF], 1
set P0[has_socklen_t], 1
set P0[has_static_linking], 1
set P0[hugefloatval], long double
set P0[hugefloatvalsize], 12
set P0[hugeintval], long long
set P0[hugeintvalsize], 8
set P0[i386_has_gcc_cmpxchg], 1
set P0[i386_has_mmx], 1
set P0[i386_has_sse], 1
set P0[i_arpainet], define
set P0[i_bsdioctl], 
set P0[i_crypt], define
set P0[i_db], P1
set P0[i_dbm], P1
set P0[i_dirent], define
set P0[i_dld], P1
set P0[i_dlfcn], define
set P0[i_fcntl], define
set P0[i_float], define
set P0[i_fp], P1
set P0[i_fp_class], P1
set P0[i_gdbm], P1
set P0[i_grp], define
set P0[i_ieeefp], P1
set P0[i_inttypes], define
set P0[i_langinfo], define
set P0[i_lib_pthread], 1
set P0[i_libutil], P1
set P0[i_limits], define
set P0[i_locale], define
set P0[i_machcthr], P1
set P0[i_malloc], define
set P0[i_math], define
set P0[i_memory], P1
set P0[i_mntent], define
set P0[i_ndbm], P1
set P0[i_netdb],