Author: jkeenan
Date: Mon Mar 5 17:48:52 2007
New Revision: 17360
Added:
branches/buildtools/languages/tcl/runtime/builtin/auto_execok.pir (props
changed)
- copied unchanged from r17358,
/tags/buildtools-17357/languages/tcl/runtime/builtin/auto_execok.pir
branches/buildtools/languages/tcl/runtime/builtin/auto_load.pir (props
changed)
- copied unchanged from r17358,
/tags/buildtools-17357/languages/tcl/runtime/builtin/auto_load.pir
branches/buildtools/languages/tcl/runtime/builtin/exec.pir (props changed)
- copied unchanged from r17358,
/tags/buildtools-17357/languages/tcl/runtime/builtin/exec.pir
branches/buildtools/languages/tcl/runtime/builtin/fconfigure.pir (props
changed)
- copied unchanged from r17358,
/tags/buildtools-17357/languages/tcl/runtime/builtin/fconfigure.pir
branches/buildtools/languages/tcl/runtime/builtin/glob.pir (props changed)
- copied unchanged from r17358,
/tags/buildtools-17357/languages/tcl/runtime/builtin/glob.pir
branches/buildtools/languages/tcl/runtime/builtin/interp.pir (props
changed)
- copied unchanged from r17358,
/tags/buildtools-17357/languages/tcl/runtime/builtin/interp.pir
branches/buildtools/languages/tcl/runtime/builtin/update.pir (props
changed)
- copied unchanged from r17358,
/tags/buildtools-17357/languages/tcl/runtime/builtin/update.pir
Removed:
branches/buildtools/languages/tcl/src/builtin/auto_execok.pir
branches/buildtools/languages/tcl/src/builtin/auto_load.pir
branches/buildtools/languages/tcl/src/builtin/exec.pir
branches/buildtools/languages/tcl/src/builtin/fconfigure.pir
branches/buildtools/languages/tcl/src/builtin/glob.pir
branches/buildtools/languages/tcl/src/builtin/interp.pir
branches/buildtools/languages/tcl/src/builtin/trace.pir
branches/buildtools/languages/tcl/src/builtin/update.pir
Modified:
branches/buildtools/ (props changed)
branches/buildtools/MANIFEST
branches/buildtools/RELEASE_INSTRUCTIONS
branches/buildtools/docs/pdds/draft/pdd15_objects.pod
branches/buildtools/languages/plumhead/src/partridge/Plumhead.pg
branches/buildtools/languages/plumhead/src/partridge/PlumheadPAST.tg
branches/buildtools/languages/plumhead/t/array.t
branches/buildtools/languages/tcl/config/makefiles/root.in
branches/buildtools/languages/tcl/runtime/builtin/trace.pir (contents,
props changed)
branches/buildtools/languages/tcl/src/pmc/tclfloat.pmc
branches/buildtools/languages/tcl/src/pmc/tclint.pmc
branches/buildtools/lib/Parrot/Pmc2c.pm
branches/buildtools/src/pmc/smop_class.pmc
branches/buildtools/tools/util/crow.pir
Log:
Refreshing buildtools branch with files recently updated in trunk.
Modified: branches/buildtools/MANIFEST
==============================================================================
--- branches/buildtools/MANIFEST (original)
+++ branches/buildtools/MANIFEST Mon Mar 5 17:48:52 2007
@@ -1962,6 +1962,8 @@
languages/tcl/runtime/builtin/append.pir [tcl]
languages/tcl/runtime/builtin/apply.pir [tcl]
languages/tcl/runtime/builtin/array.pir [tcl]
+languages/tcl/runtime/builtin/auto_execok.pir [tcl]
+languages/tcl/runtime/builtin/auto_load.pir [tcl]
languages/tcl/runtime/builtin/binary.pir [tcl]
languages/tcl/runtime/builtin/catch.pir [tcl]
languages/tcl/runtime/builtin/clock.pir [tcl]
@@ -1971,16 +1973,20 @@
languages/tcl/runtime/builtin/encoding.pir [tcl]
languages/tcl/runtime/builtin/error.pir [tcl]
languages/tcl/runtime/builtin/eval.pir [tcl]
+languages/tcl/runtime/builtin/exec.pir [tcl]
languages/tcl/runtime/builtin/expr.pir [tcl]
+languages/tcl/runtime/builtin/fconfigure.pir [tcl]
languages/tcl/runtime/builtin/file.pir [tcl]
languages/tcl/runtime/builtin/fileevent.pir [tcl]
languages/tcl/runtime/builtin/foreach.pir [tcl]
languages/tcl/runtime/builtin/format.pir [tcl]
languages/tcl/runtime/builtin/gets.pir [tcl]
+languages/tcl/runtime/builtin/glob.pir [tcl]
languages/tcl/runtime/builtin/global.pir [tcl]
languages/tcl/runtime/builtin/if.pir [tcl]
languages/tcl/runtime/builtin/info.pir [tcl]
languages/tcl/runtime/builtin/inline.pir [tcl]
+languages/tcl/runtime/builtin/interp.pir [tcl]
languages/tcl/runtime/builtin/lappend.pir [tcl]
languages/tcl/runtime/builtin/lassign.pir [tcl]
languages/tcl/runtime/builtin/lindex.pir [tcl]
@@ -2010,6 +2016,7 @@
languages/tcl/runtime/builtin/trace.pir [tcl]
languages/tcl/runtime/builtin/unknown.pir [tcl]
languages/tcl/runtime/builtin/unset.pir [tcl]
+languages/tcl/runtime/builtin/update.pir [tcl]
languages/tcl/runtime/builtin/uplevel.pir [tcl]
languages/tcl/runtime/builtin/upvar.pir [tcl]
languages/tcl/runtime/builtin/variable.pir [tcl]
@@ -2022,21 +2029,15 @@
languages/tcl/runtime/variables.pir [tcl]
languages/tcl/src/binary.c [tcl]
languages/tcl/src/binary.h [tcl]
-languages/tcl/src/builtin/auto_execok.pir [tcl]
-languages/tcl/src/builtin/auto_load.pir [tcl]
languages/tcl/src/builtin/break.tmt [tcl]
languages/tcl/src/builtin/cd.pir [tcl]
languages/tcl/src/builtin/continue.tmt [tcl]
languages/tcl/src/builtin/eof.tmt [tcl]
-languages/tcl/src/builtin/exec.pir [tcl]
languages/tcl/src/builtin/exit.tmt [tcl]
languages/tcl/src/builtin/expr.pir [tcl]
-languages/tcl/src/builtin/fconfigure.pir [tcl]
languages/tcl/src/builtin/flush.tmt [tcl]
languages/tcl/src/builtin/for.tmt [tcl]
-languages/tcl/src/builtin/glob.pir [tcl]
languages/tcl/src/builtin/incr.tmt [tcl]
-languages/tcl/src/builtin/interp.pir [tcl]
languages/tcl/src/builtin/join.tmt [tcl]
languages/tcl/src/builtin/list.pir [tcl]
languages/tcl/src/builtin/llength.tmt [tcl]
@@ -2045,8 +2046,6 @@
languages/tcl/src/builtin/return.pir [tcl]
languages/tcl/src/builtin/set.tmt [tcl]
languages/tcl/src/builtin/time.tmt [tcl]
-languages/tcl/src/builtin/trace.pir [tcl]
-languages/tcl/src/builtin/update.pir [tcl]
languages/tcl/src/builtin/while.tmt [tcl]
languages/tcl/src/class/tclconst.pir [tcl]
languages/tcl/src/class/tclproc.pir [tcl]
Modified: branches/buildtools/RELEASE_INSTRUCTIONS
==============================================================================
--- branches/buildtools/RELEASE_INSTRUCTIONS (original)
+++ branches/buildtools/RELEASE_INSTRUCTIONS Mon Mar 5 17:48:52 2007
@@ -148,8 +148,8 @@
- Jan 16th (0.4.8), Jerry Gay (particle)
- Feb 20th (0.4.9), Patrick Michaud (pmichaud)
- - Mar 20th, Matt Diephouse (mdiep)
- - Apr 17th, Will Coleda (coke)
+ - Mar 20th, Will Coleda (coke)
+ - Apr 17th, Matt Diephouse (mdiep)
- May 15th, chromatic
- Jun 19th, Allison Randal
- Jul 17th, Jerry Gay (particle)
Modified: branches/buildtools/docs/pdds/draft/pdd15_objects.pod
==============================================================================
--- branches/buildtools/docs/pdds/draft/pdd15_objects.pod (original)
+++ branches/buildtools/docs/pdds/draft/pdd15_objects.pod Mon Mar 5
17:48:52 2007
@@ -22,7 +22,7 @@
=head2 Class
-A class defines a pattern of characteristcs and behaviors from which
+A class defines a pattern of characteristics and behaviors from which
objects are constructed.
=head2 Attribute
@@ -34,7 +34,7 @@
will have the same set of attributes. Most OO languages don't allow
attribute changes to existing classes, but Parrot's base attribute
system does allow it. In order to safely support advanced dynamic
-features in HLLs, attributes are not accesible via fixed attribute
+features in HLLs, attributes are not accessible via fixed attribute
offsets, but only via named lookup.
=head2 Method
@@ -158,7 +158,7 @@
class for each OO class, and they all share the Class or Object vtable,
respectively.
-An instance of the Class PMC has six attributes, which are:
+An instance of the Class PMC has ten attributes, which are:
=over 4
@@ -191,12 +191,12 @@
=item 5
-An hash PMC of the methods defined in the class or composed into the
+A hash PMC of the methods defined in the class or composed into the
class
=item 6
-An hash PMC of the overloaded PMC vtable entries for the class.
+A hash PMC of the overloaded PMC vtable entries for the class.
=item 7
@@ -230,7 +230,7 @@
class. When instantiating an object, the object data store is created as
a ResizablePMCArray, so doesn't need any specific details of the class's
attribute structure. As attributes are set in the object (based on the
-index in the lookup table), the Array expands to accomodate the
+index in the lookup table), the Array expands to accommodate the
attribute indexes that are actually used. In the common case, a
relatively small set near the lower index range is all that will be
used.
@@ -313,7 +313,7 @@
objects still point to the old class and do their method resolution and
attribute lookup through that class. If a class hasn't been
instantiated, adding a method doesn't create a new class. If it has been
-instantiated, it creates a new class the first time its extended,
+instantiated, it creates a new class the first time it's extended,
and then doesn't create a new class until it is instantiated again.) The
class registry needs to have names removed entirely (it doesn't care
about names anymore). Low-level PMC types also need entries in the
@@ -365,7 +365,7 @@
sections below on L<Objects> and L<Vtables>.
[stream-of-consciousness again]
-In addition to a value type, objects can have a containter type. The
+In addition to a value type, objects can have a container type. The
container type can't be stored in the object itself, because a single
object may live within multiple containers. So, the container type (when
it exists) is stored in the LexPad or Namespace entry for a particular
@@ -384,7 +384,7 @@
=head2 Role PMC API
-An instance of the Role PMC has four attributes, which are:
+An instance of the Role PMC has five attributes, which are:
=over 4
@@ -680,7 +680,7 @@
=head1 Explanations
To get a new class, you can do a C<newclass>, which creates a new class with no
-parents besides parrot's default super-ish parent class.
+parents besides Parrot's default super-ish parent class.
To get a new child class, you have two potential options:
@@ -703,7 +703,7 @@
Classes may override the vtable methods, allowing objects of a class to behave
like a primitive PMC. Each vtable slot has a corresponding named method that
-parrot looks for in your class hierarchy when an object is used in a primitive
+Parrot looks for in your class hierarchy when an object is used in a primitive
context.
To use these properly at a low-level requires a good working knowledge of the
@@ -716,7 +716,7 @@
methods are called by the interpreter--once a vtable method is exited any
continuation taken within it is no longer valid and may not be used.
-Note that any class method that wishes to use parrot's multi-method dispatch
+Note that any class method that wishes to use Parrot's multi-method dispatch
system may do so. This is, in fact, encouraged, though it is not required. In
the absence of explicit multimethod dispatch, a left-side wins scheme is used.
@@ -1116,7 +1116,7 @@
=head2 Objectspace
-Ruby: Objectspace in ruby allows the programmer to iterate through every live
object
+Ruby: Objectspace in Ruby allows the programmer to iterate through every live
object
in the system. There is some debate about how to make this play nice with
different
garbage collection schemes.
@@ -1177,7 +1177,7 @@
.Net: Single inheritance.
-Ruby: Single inheritance but support for mixins of ruby modules.
+Ruby: Single inheritance but support for mixins of Ruby modules.
=head2 Interfaces
@@ -1258,7 +1258,7 @@
=head2 Translation
The following list a set of languages, then within each language what the
-parrot term translates to.
+Parrot term translates to.
=over 4
@@ -1268,7 +1268,7 @@
=item Attribute
-A Python attribute maps to a parrot property
+A Python attribute maps to a Parrot property
=back
@@ -1278,7 +1278,7 @@
=item Attribute
-What .NET calls an attribute parrot calls a property
+What .NET calls an attribute Parrot calls a property
=item Property
Modified: branches/buildtools/languages/plumhead/src/partridge/Plumhead.pg
==============================================================================
--- branches/buildtools/languages/plumhead/src/partridge/Plumhead.pg
(original)
+++ branches/buildtools/languages/plumhead/src/partridge/Plumhead.pg Mon Mar
5 17:48:52 2007
@@ -36,7 +36,7 @@
token ELSE { <'else'> }
token program { ^ <SEA> <code> }
-rule code { <?CODE_START> <statement>* <?CODE_END> }
+rule code { <?CODE_START> <statement>* <?CODE_END>? }
rule relational_expression { <expression> <rel_op_clause>? }
@@ -45,6 +45,7 @@
| <IF> <?PAREN_OPEN> <relational_expression> <?PAREN_CLOSE> \{ <statement>*
\} <else_clause>?
| <inline_sea>
| <scalar_assign>
+ | <array_assign>
}
rule else_clause { <?ELSE> \{ <statement>* \} }
@@ -52,15 +53,19 @@
rule rel_op_clause { <REL_OP> <expression> }
rule else_clause { <?ELSE> \{ <statement>* \} }
token inline_sea { <?CODE_END> <SEA> <?CODE_START> }
-rule scalar_assign { <scalar> <ASSIGN_OP> <expression> ; }
-rule scalar { <VAR_NAME> }
+rule scalar_assign { <var> <ASSIGN_OP> <expression> ; }
+rule array_assign { <array_elem> <ASSIGN_OP> <expression> ; }
token expression { <DOUBLEQUOTE_STRING>
| <SINGLEQUOTE_STRING>
| <bitwise_expression>
- | <scalar>
+ | <array_elem>
+ | <var>
}
+rule array_elem { <VAR_NAME> <'['> <expression> <']'> }
+rule var { <VAR_NAME> }
+
rule bitwise_expression { <adding_expression> <bitwise_tail>? }
rule bitwise_tail { <BITWISE_OP> <adding_expression> }
Modified: branches/buildtools/languages/plumhead/src/partridge/PlumheadPAST.tg
==============================================================================
--- branches/buildtools/languages/plumhead/src/partridge/PlumheadPAST.tg
(original)
+++ branches/buildtools/languages/plumhead/src/partridge/PlumheadPAST.tg
Mon Mar 5 17:48:52 2007
@@ -74,7 +74,7 @@
iter = new .Iterator, $P0
iter_loop:
unless iter goto iter_end
- .local pmc cnode, past_else_block, past_condition,
past_expression, past_scalar, past_assign, past_rel_expression, past_echo,
past_if, past_if_block, past_sea
+ .local pmc cnode, past_else_block, past_condition,
past_expression, past_var, past_array_elem, past_assign, past_rel_expression,
past_echo, past_if, past_if_block, past_sea
cnode = shift iter
if null cnode goto iter_loop
@@ -103,7 +103,7 @@
name = $P6
name = 'infix:' . name
past_expression = tree.'get'('past', $P2,
'Plumhead::Grammar::expression')
- past_rel_expression = tree.'get'('past', $P4,
'Plumhead::Grammar::expression')
+ past_rel_expression = tree.'get'('past', $P5,
'Plumhead::Grammar::expression')
past_condition = new 'PAST::Op'
past_condition.'init'( past_expression,
past_rel_expression, 'node'=> node, 'name' => name )
goto got_past_condition
@@ -136,17 +136,30 @@
$P1 = cnode['scalar_assign']
if null $P1 goto no_scalar_assign
- $P2 = $P1['scalar']
+ $P2 = $P1['var']
$P3 = $P1['expression']
if null $P2 goto iter_loop
- past_scalar = tree.'get'('past', $P2,
'Plumhead::Grammar::expression')
+ past_var = tree.'get'('past', $P2,
'Plumhead::Grammar::expression')
past_expression = tree.'get'('past', $P3,
'Plumhead::Grammar::expression')
past_assign = new 'PAST::Op'
- past_assign.'init'( past_scalar, past_expression,
'node'=> node, 'name' => 'infix:=', 'pasttype' => 'assign' )
+ past_assign.'init'( past_var, past_expression,
'node'=> node, 'name' => 'infix:=', 'pasttype' => 'assign' )
past.'push'(past_assign)
goto iter_loop
no_scalar_assign:
+ $P1 = cnode['array_assign']
+ if null $P1 goto no_array_assign
+ $P2 = $P1['array_elem']
+ $P3 = $P1['expression']
+ if null $P2 goto iter_loop
+ past_array_elem = tree.'get'('past', $P2,
'Plumhead::Grammar::expression')
+ past_expression = tree.'get'('past', $P3,
'Plumhead::Grammar::expression')
+ past_assign = new 'PAST::Op'
+ past_assign.'init'( past_array_elem, past_expression,
'node'=> node, 'name' => 'infix:=', 'pasttype' => 'assign' )
+ past.'push'(past_assign)
+ goto iter_loop
+ no_array_assign:
+
# unknown statements are ignored
goto iter_loop
iter_end:
@@ -162,9 +175,26 @@
$P0 = node['expression']
if null $P0 goto no_expression_1
+ .local pmc dummy_1
+ dummy_1 = node['VAR_NAME']
+ if null dummy_1 goto no_var_name_1
+ .local string var
+ var = dummy_1
+ past = new 'PAST::Var'
+ .local pmc past_expression_1
+ past_expression_1 = tree.'get'('past', $P0,
'Plumhead::Grammar::expression')
+ past.'init'( past_expression_1, 'name' => var, 'viviself' =>
'.Hash', 'islvalue' => 1 )
+ goto handled_expression
+ no_var_name_1:
+ past = tree.'get'('past', $P0, 'Plumhead::Grammar::expression')
+ goto handled_expression
+ no_expression_1:
+
+ $P0 = node['array_elem']
+ if null $P0 goto no_array_elem_1
past = tree.'get'('past', $P0, 'Plumhead::Grammar::expression')
goto handled_expression
- no_expression_1:
+ no_array_elem_1:
$P0 = node['DOUBLEQUOTE_STRING']
if null $P0 goto no_DOUBLEQUOTE_STRING
@@ -291,11 +321,11 @@
goto handled_expression
no_postfix_expression:
- $P0 = node['scalar']
- if null $P0 goto no_scalar
+ $P0 = node['var']
+ if null $P0 goto no_var
past = tree.'get'('past', $P0, 'Plumhead::Grammar::expression')
goto handled_expression
- no_scalar:
+ no_var:
$P0 = node['VAR_NAME']
if null $P0 goto no_var_name
Modified: branches/buildtools/languages/plumhead/t/array.t
==============================================================================
--- branches/buildtools/languages/plumhead/t/array.t (original)
+++ branches/buildtools/languages/plumhead/t/array.t Mon Mar 5 17:48:52 2007
@@ -17,14 +17,13 @@
# pragmata
use strict;
use warnings;
-use 5.006_001;
use FindBin;
use lib "$FindBin::Bin/../lib", "$FindBin::Bin/../../../lib";
use Parrot::Config ();
use Parrot::Test;
-use Test::More tests => 5;
+use Test::More tests => 6;
language_output_is( 'Plumhead', <<'END_CODE', <<'END_OUT', 'less than' );
@@ -42,6 +41,16 @@
$hello['world'] = 'hi';
echo $hello['world'];
echo "\n";
+?>
+END_CODE
+hi
+END_OUT
+
+language_output_is( 'Plumhead', <<'END_CODE', <<'END_OUT', 'less than' );
+<?php
+$hello['world'] = 'hi';
+echo $hello['world'];
+echo "\n";
END_CODE
hi
END_OUT
Modified: branches/buildtools/languages/tcl/config/makefiles/root.in
==============================================================================
--- branches/buildtools/languages/tcl/config/makefiles/root.in (original)
+++ branches/buildtools/languages/tcl/config/makefiles/root.in Mon Mar 5
17:48:52 2007
@@ -52,18 +52,10 @@
RUNTIME_PIR = $(addprefix runtime/builtin/,$(notdir $(wildcard
languages/tcl/runtime/builtin/*.pir)))
DEPS = \
-$(C_BUILTIN)/auto_execok.pir \
-$(C_BUILTIN)/auto_load.pir \
$(C_BUILTIN)/cd.pir \
-$(C_BUILTIN)/exec.pir \
$(C_BUILTIN)/expr.pir \
-$(C_BUILTIN)/fconfigure.pir \
-$(C_BUILTIN)/glob.pir \
-$(C_BUILTIN)/interp.pir \
$(C_BUILTIN)/list.pir \
$(C_BUILTIN)/return.pir \
-$(C_BUILTIN)/trace.pir \
-$(C_BUILTIN)/update.pir \
runtime/conversions.pir \
runtime/list_to_string.pir \
runtime/string_to_list.pir \
Modified: branches/buildtools/languages/tcl/runtime/builtin/trace.pir
==============================================================================
--- branches/buildtools/languages/tcl/runtime/builtin/trace.pir (original)
+++ branches/buildtools/languages/tcl/runtime/builtin/trace.pir Mon Mar 5
17:48:52 2007
@@ -1,5 +1,14 @@
-.HLL 'Tcl', 'tcl_group'
+# RT#40703: Stub
+# help tcltest compile
+
+.HLL '_Tcl', 'tcl_group'
.namespace
-.sub '&trace'
+.sub 'trace'
+ .param string retval
+ .param pmc raw_args
+ .param pmc argv
+
+ .return('')
.end
+
Modified: branches/buildtools/languages/tcl/src/pmc/tclfloat.pmc
==============================================================================
--- branches/buildtools/languages/tcl/src/pmc/tclfloat.pmc (original)
+++ branches/buildtools/languages/tcl/src/pmc/tclfloat.pmc Mon Mar 5
17:48:52 2007
@@ -77,9 +77,6 @@
return buff;
}
- METHOD PMC* interpret() {
- return SELF;
- }
}
/*
Modified: branches/buildtools/languages/tcl/src/pmc/tclint.pmc
==============================================================================
--- branches/buildtools/languages/tcl/src/pmc/tclint.pmc (original)
+++ branches/buildtools/languages/tcl/src/pmc/tclint.pmc Mon Mar 5
17:48:52 2007
@@ -53,10 +53,6 @@
}
}
- METHOD PMC* interpret() {
- return SELF;
- }
-
}
/*
Modified: branches/buildtools/lib/Parrot/Pmc2c.pm
==============================================================================
--- branches/buildtools/lib/Parrot/Pmc2c.pm (original)
+++ branches/buildtools/lib/Parrot/Pmc2c.pm Mon Mar 5 17:48:52 2007
@@ -25,6 +25,7 @@
use Parrot::PMC qw(%pmc_types);
use Parrot::Pmc2c::UtilFunctions qw( gen_ret dont_edit count_newlines
dynext_load_code c_code_coda );
use Text::Balanced 'extract_bracketed';
+use Parrot::Pmc2c::PMETHODs;
=back
@@ -523,6 +524,7 @@
else {
$total_body = rewrite_nci_method( $classname, $meth, $body );
}
+ Parrot::Pmc2c::PMETHODs::rewrite_pminvoke($method, \$total_body);
# now split into MMD if necessary:
my $additional_bodies = '';
Modified: branches/buildtools/src/pmc/smop_class.pmc
==============================================================================
--- branches/buildtools/src/pmc/smop_class.pmc (original)
+++ branches/buildtools/src/pmc/smop_class.pmc Mon Mar 5 17:48:52 2007
@@ -8,8 +8,7 @@
=head1 DESCRIPTION
-This class, smop_class, implements the class class of the simple meta
-object protocol.
+This class, smop_class, implements the class class of the simple meta object
protocol.
=head2 Functions
@@ -31,22 +30,6 @@
PMC *superclasses;
} SMOP_Class;
-static void smop_init(Interp *interp, PMC *self) {
- SMOP_Class *smop = NULL;
- /* But we are a class, really */
- PObj_is_class_SET(self);
- /* turn on marking of the class_data array */
- PObj_data_is_PMC_array_SET(self);
- /* turn on custom destruction since our PMC* array is dynamically
allocated */
- PObj_active_destroy_SET(self);
-
- PMC_data(self) = mem_sys_allocate_zeroed(sizeof(SMOP_Class));
- smop = SMOP(self);
- smop->attributes = pmc_new(interp, enum_class_Hash);
- smop->methods = pmc_new(interp, enum_class_Hash);
- smop->superclasses = pmc_new(interp, enum_class_Hash);
-}
-
PARROT_API void Parrot_smop_find_class(Interp *interp, PMC *self);
PARROT_API void Parrot_smop_find_class(Interp *interp, PMC *self) {
}
@@ -68,9 +51,56 @@
=cut
*/
+ void class_init() {
+ if (pass) {
+ /*Parrot_SMOP_Class_class_init_2(interp, NULL);*/
+ }
+ }
+
+ METHOD void class_init_2()
+ {
+ int i;
+ PMC* class = pmc_new(interp, enum_class_SMOP_Class);
+ PMC* class_meta;
+ PMC* class_string;
+ PMC* attributes = pmc_new(interp, enum_class_ResizablePMCArray);
+ const char *attribute_names[] = { "name", "namespace",
"_parrotclass", "attributes", "methods", "superclasses" };
+
+ for (i=0; i<6; i++) {
+ PMC* attribute = pmc_new(interp, enum_class_SMOP_Attribute);
+ STRING *attrib_name = string_from_const_cstring(interp,
attribute_names[i], 0);
+ PMINVOKE(interp, attribute, "name", STRING* attrib_name);
+ PMINVOKE(interp, attribute, "class", PMC* class);
+ VTABLE_push_pmc(interp, attributes, attribute);
+ }
+
+ /* we sidestep the MetaModel bootstrap problem by building the
MetaClass manually */
+
+ (PMC* class_meta) = PMINVOKE(interp, class, "new");
+ class_string = pmc_new(interp, enum_class_String);
+ VTABLE_set_string_native(interp, class_string,
string_from_const_cstring(interp, "Class", 0));
+ VTABLE_set_attr_str(interp, class_meta,
string_from_const_cstring(interp, attribute_names[0], 0), class_string);
+ VTABLE_set_attr_str(interp, class_meta,
string_from_const_cstring(interp, attribute_names[2], 0), class);
+ VTABLE_init(interp,class_meta);
+ VTABLE_set_attr_str(interp, class_meta,
string_from_const_cstring(interp, attribute_names[3], 0), attributes);
+ Parrot_store_global_n(interp, interp->root_namespace,
string_from_const_cstring(interp, "class_object", 0), class_meta);
+ }
+
void init() {
- smop_init(INTERP, SELF);
+ SMOP_Class *smop;
+ /* But we are a class, really */
+ PObj_is_class_SET(SELF);
+ /* turn on marking of the class_data array */
+ PObj_data_is_PMC_array_SET(SELF);
+ /* turn on custom destruction since our PMC* array is dynamically
allocated */
+ PObj_active_destroy_SET(SELF);
+
+ PMC_data(SELF) = mem_sys_allocate_zeroed(sizeof(SMOP_Class));
+ smop = SMOP(SELF);
+ smop->attributes = pmc_new(interp, enum_class_Hash);
+ smop->methods = pmc_new(interp, enum_class_Hash);
+ smop->superclasses = pmc_new(interp, enum_class_Hash);
}
void init_pmc(PMC* args) {
@@ -97,7 +127,7 @@
*/
void destroy() {
- mem_sys_free(PMC_data(SELF));
+ mem_sys_free(PMC_data(SELF));
}
PMETHOD void name(PMC *name :optional, int got_name :opt_flag) {
@@ -150,6 +180,10 @@
/* SELF.set_meta_attribute(attribute_name, new_attribute); */
}
+ PMC* get_attr_str(STRING* attr_name) {
+ return PMCNULL;
+ }
+
METHOD void add_superclass(STRING* superclass) {
/* PMC *newsuper = find_class(superclass); */
}
Modified: branches/buildtools/tools/util/crow.pir
==============================================================================
--- branches/buildtools/tools/util/crow.pir (original)
+++ branches/buildtools/tools/util/crow.pir Mon Mar 5 17:48:52 2007
@@ -71,16 +71,16 @@
'infix://='($P0, 'Socorro')
$P0 = 'get_or_vivify'(data, 'web.root')
- $P0 = 'infix://='($P0, 'http://parrotcode.org')
+ 'infix://='($P0, 'http://parrotcode.org')
$P0 = 'get_or_vivify'(data, 'web.source')
- $P0 = 'infix://='($P0, 'http://parrotcode.org/source')
+ 'infix://='($P0, 'http://parrotcode.org/source')
$P0 = 'get_or_vivify'(data, 'date')
- $P0 = 'infix://='($P0, '22 February 2007')
+ 'infix://='($P0, '22 February 2007')
$P0 = 'get_or_vivify'(data, 'nextdate')
- $P0 = 'infix://='($P0, 'xx March 2007')
+ 'infix://='($P0, 'xx March 2007')
# get data from NEWS
$S0 = data['version']
@@ -149,10 +149,17 @@
.param pmc a
.param pmc b
+ if null a goto agg_undefined
$I0 = defined a
- if $I0 goto OP_end
+ if $I0 goto return
assign a, b
- OP_end:
+ return:
+ .return ()
+
+ agg_undefined:
+ $P0 = new .Exception
+ $P0['_message'] = "cannot assign to Null PMC!"
+ throw $P0
.end