Author: cotto Date: Sat Jan 10 23:34:33 2009 New Revision: 35394 Modified: trunk/t/pmc/n_arithmetics.t trunk/t/pmc/namespace.t trunk/t/pmc/nci.t trunk/t/pmc/null.t trunk/t/pmc/object-meths.t trunk/t/pmc/object-mro.t trunk/t/pmc/object.t trunk/t/pmc/objects.t trunk/t/pmc/orderedhash.t
Log: [t] more string->key conversions Modified: trunk/t/pmc/n_arithmetics.t ============================================================================== --- trunk/t/pmc/n_arithmetics.t (original) +++ trunk/t/pmc/n_arithmetics.t Sat Jan 10 23:34:33 2009 @@ -47,7 +47,7 @@ ### Operations on a single INTVAL ### .sub take_the_negative_of_an_integer - $P0 = new 'Integer' + $P0 = new ['Integer'] ## negate zero. set $P0, 0 n_neg $P1, $P0 @@ -71,7 +71,7 @@ .end .sub take_the_absolute_value_of_an_integer - $P0 = new 'Integer' + $P0 = new ['Integer'] ## find absolute zero (so to speak). set $P0, 0 $P1 = n_abs $P0 @@ -98,11 +98,11 @@ ### first arg is Integer, second arg is Integer ### .sub add_integer_to_integer - $P0 = new 'Integer' + $P0 = new ['Integer'] set $P0, 4000 - $P1 = new 'Integer' + $P1 = new ['Integer'] set $P1, -123 - $P2 = new 'Integer' + $P2 = new ['Integer'] set $P2, 666 add $P2, $P0, $P1 is( $P2, 3877, 'add integer to integer' ) @@ -124,11 +124,11 @@ .end .sub subtract_integer_from_integer - $P0 = new 'Integer' + $P0 = new ['Integer'] set $P0, 4000 - $P1 = new 'Integer' + $P1 = new ['Integer'] set $P1, -123 - $P2 = new 'Integer' + $P2 = new ['Integer'] set $P2, 666 sub $P2, $P0, $P1 is( $P2, 4123, 'subtract Integer from Integer' ) @@ -150,11 +150,11 @@ .end .sub multiply_integer_by_integer - $P0 = new 'Integer' + $P0 = new ['Integer'] set $P0, 4000 - $P1 = new 'Integer' + $P1 = new ['Integer'] set $P1, -123 - $P2 = new 'Integer' + $P2 = new ['Integer'] set $P2, 666 mul $P2, $P0, $P1 is( $P2, -492000, 'multiply Integer by Integer' ) @@ -168,11 +168,11 @@ .end .sub divide_integer_by_integer - $P0 = new 'Integer' + $P0 = new ['Integer'] set $P0, 4000 - $P1 = new 'Integer' + $P1 = new ['Integer'] set $P1, -123 - $P2 = new 'Integer' + $P2 = new ['Integer'] set $P2, 666 div $P2, $P0, $P1 is( $P2, -32.5203, 'divide Integer by Integer', 0.0001 ) @@ -189,7 +189,7 @@ ### Operations on a single NUMVAL ### .sub negate_a_float - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, 0 $P1 = n_neg $P0 is( $P1, 0, 'neg of Float 0 is 0' ) @@ -205,7 +205,7 @@ .end .sub take_the_absolute_value_of_a_float - $P0 = new 'Integer' + $P0 = new ['Integer'] set $P0, 0 $P1 = n_abs $P0 is( $P1, 0, 'abs value of float 0 is zero' ) @@ -224,9 +224,9 @@ ### FLOATVAL and INTVAL tests ### .sub add_integer_to_float - $P10 = new 'Integer' + $P10 = new ['Integer'] set $P10, 4000 - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, -123.123 add $P1, $P0, $P10 is( $P1, 3876.877, 'add Float and Int' ) @@ -248,9 +248,9 @@ .end .sub subtract_integer_from_float - $P10 = new 'Integer' + $P10 = new ['Integer'] set $P10, 4000 - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, -123.123 sub $P1, $P0, $P10 is( $P1, -4123.123, 'subtract Int from Float' ) @@ -272,9 +272,9 @@ .end .sub multiply_float_by_integer - $P10 = new 'Integer' + $P10 = new ['Integer'] set $P10, 4000 - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, -123.123 mul $P1, $P0, $P10 is( $P1, -492492, 'multiply Float by Int' ) @@ -296,9 +296,9 @@ .end .sub divide_float_by_integer - $P10 = new 'Integer' + $P10 = new ['Integer'] set $P10, 4000 - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, -123.123 div $P1, $P0, $P10 is( $P1, -0.03078075, 'divide Float by Int', 0.0001 ) @@ -326,11 +326,11 @@ ### FLOATVAL and FLOATVAL tests ### .sub add_float_to_float - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, 4000.246 - $P1 = new 'Float' + $P1 = new ['Float'] set $P1, -123.123 - $P2 = new 'Float' + $P2 = new ['Float'] set $P2, 6.66 add $P2, $P0, $P1 is( $P2, 3877.123, 'add Float to Float' ) @@ -350,9 +350,9 @@ ## This tests n_infix_ic_p_p_nc for n_add, n_sub, n_mul, and n_div. Note that ## there is no n_infix_ic_p_nc_p op; the PMC argument always comes first. .sub add_sub_mul_div_of_float_with_constants - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, 4000.246 - $P1 = new 'Float' + $P1 = new ['Float'] set $P1, -123.123 $P2 = add $P1, 6.78 is( $P2, -116.343, 'add neg Float to constant Float' ) @@ -365,11 +365,11 @@ .end .sub subtract_float_from_float - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, 4000.246 - $P1 = new 'Float' + $P1 = new ['Float'] set $P1, -123.123 - $P2 = new 'Float' + $P2 = new ['Float'] set $P2, 6.66 sub $P2, $P0, $P1 is( $P2, 4123.369, 'subtract Float from Float' ) @@ -387,11 +387,11 @@ .end .sub multiply_float_by_float - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, 400.0246 - $P1 = new 'Float' + $P1 = new ['Float'] set $P1, -123.123 - $P2 = new 'Float' + $P2 = new ['Float'] set $P2, 6.66 mul $P2, $P0, $P1 is( $P2, -49252.2288258, 'multiply Float from Float', 0.000001 ) @@ -409,11 +409,11 @@ .end .sub divide_float_by_float - $P0 = new 'Float' + $P0 = new ['Float'] set $P0, 4000.246 - $P1 = new 'Float' + $P1 = new ['Float'] set $P1, -123.123 - $P2 = new 'Float' + $P2 = new ['Float'] set $P2, 6.66 div $P2, $P1, $P0 is( $P2, -0.0307788571002883, 'divide neg Float by pos Float', 0.0000001 ) @@ -431,7 +431,7 @@ .end .sub verify_new_pmc - $P0 = new 'Integer' + $P0 = new ['Integer'] $P1 = $P0 $P0 = add $P0, 1 is( $P0, 1, 'add constant to new (unassigned) PMC' ) Modified: trunk/t/pmc/namespace.t ============================================================================== --- trunk/t/pmc/namespace.t (original) +++ trunk/t/pmc/namespace.t Sat Jan 10 23:34:33 2009 @@ -26,17 +26,17 @@ # L<PDD21/Namespace PMC API/> pir_output_is( <<'CODE', <<'OUT', 'new' ); .sub 'test' :main - new $P0, 'NameSpace' - say "ok 1 - $P0 = new 'NameSpace'" + new $P0, ['NameSpace'] + say "ok 1 - $P0 = new ['NameSpace']" .end CODE -ok 1 - $P0 = new 'NameSpace' +ok 1 - $P0 = new ['NameSpace'] OUT # L<PDD21/Namespace PMC API/=head4 Untyped Interface> pir_output_is( <<'CODE', <<'OUT', 'NameSpace does "hash"' ); .sub 'test' :main - new $P0, 'NameSpace' + new $P0, ['NameSpace'] $I0 = does $P0, 'hash' if $I0 goto ok_1 print 'not ' @@ -426,7 +426,7 @@ .include "interpinfo.pasm" $P0 = get_root_namespace $P1 = $P0["parrot"] - $P3 = new 'NameSpace' + $P3 = new ['NameSpace'] $P1["Foo"] = $P3 $P2 = $P3.'get_name'() $I2 = elements $P2 @@ -444,10 +444,10 @@ pir_output_is( <<'CODE', <<'OUTPUT', "get_namespace_p_p, getnamespace_p_kc" ); .sub main :main .include "interpinfo.pasm" - $P3 = new 'NameSpace' + $P3 = new ['NameSpace'] set_hll_global "Foo", $P3 # fetch w array - $P4 = new 'FixedStringArray' + $P4 = new ['FixedStringArray'] $P4 = 1 $P4[0] = 'Foo' $P0 = get_hll_namespace $P4 @@ -565,7 +565,7 @@ .HLL '_Tcl' .sub huh - $P0 = new 'Integer' + $P0 = new ['Integer'] $P0 = 3.14 set_global '$variable', $P0 .end @@ -614,7 +614,7 @@ .HLL 'eek' .sub foo :load :anon - $P1 = new 'String' + $P1 = new ['String'] $P1 = "3.14\n" set_global '$whee', $P1 .end @@ -653,7 +653,7 @@ .namespace [] .sub a :immediate - $P1 = new 'String' + $P1 = new ['String'] $P1 = "ok\n" set_global ['sub_namespace'], "eek", $P1 .end @@ -682,9 +682,9 @@ .sub 'test' :main .local pmc nsa, nsb, ar - ar = new 'ResizableStringArray' + ar = new ['ResizableStringArray'] push ar, 'foo' - nsa = new 'Null' + nsa = new ['Null'] nsb = get_namespace ['B'] nsb.'export_to'(nsa, ar) .end @@ -701,7 +701,7 @@ .sub 'test' :main .local pmc nsa, nsb, ar - ar = new 'Null' + ar = new ['Null'] nsa = get_namespace nsb = get_namespace ['B'] nsb.'export_to'(nsa, ar) @@ -719,7 +719,7 @@ .sub 'test' :main .local pmc nsa, nsb, ar - ar = new 'ResizableStringArray' + ar = new ['ResizableStringArray'] nsa = get_namespace nsb = get_namespace ['B'] nsb.'export_to'(nsa, ar) @@ -737,7 +737,7 @@ .sub 'test' :main .local pmc nsa, nsb, ar - ar = new 'Hash' + ar = new ['Hash'] nsa = get_namespace nsb = get_namespace ['B'] nsb.'export_to'(nsa, ar) @@ -756,7 +756,7 @@ a_foo() load_bytecode "$temp_b.pir" .local pmc nsr, nsa, nsb, ar - ar = new 'ResizableStringArray' + ar = new ['ResizableStringArray'] push ar, "b_foo" nsr = get_root_namespace nsa = nsr['a'] @@ -779,7 +779,7 @@ a_foo() load_bytecode "$temp_b.pir" .local pmc nsr, nsa, nsb, ar - ar = new 'Hash' + ar = new ['Hash'] ar["b_foo"] = "" nsr = get_root_namespace nsa = nsr['a'] @@ -802,8 +802,8 @@ a_foo() load_bytecode "$temp_b.pir" .local pmc nsr, nsa, nsb, ar, nul - nul = new 'Null' - ar = new 'Hash' + nul = new ['Null'] + ar = new ['Hash'] ar["b_foo"] = nul nsr = get_root_namespace nsa = nsr['a'] @@ -826,7 +826,7 @@ a_foo() load_bytecode "$temp_b.pir" .local pmc nsr, nsa, nsb, ar - ar = new 'Hash' + ar = new ['Hash'] ar["b_foo"] = "c_foo" nsr = get_root_namespace nsa = nsr['a'] @@ -890,7 +890,7 @@ .namespace ['foo'] .sub main :main - $P0 = new 'ResizableStringArray' + $P0 = new ['ResizableStringArray'] $P0[0] = '' $P0 = get_hll_global $P0, 'print_ok' $P0() @@ -911,7 +911,7 @@ .namespace ['foo'] .sub main :main - $P0 = new 'ResizablePMCArray' + $P0 = new ['ResizablePMCArray'] $P0 = 0 $P0 = get_hll_global $P0, 'print_ok' $P0() @@ -932,7 +932,7 @@ .namespace ['foo'] .sub main :main - $P1 = new 'ResizableStringArray' + $P1 = new ['ResizableStringArray'] $P1[0] = '' $P1 = get_hll_global $P1, 'print_ok' $P1() @@ -1033,7 +1033,7 @@ .sub a_sub .local pmc some_var - some_var = new 'String' + some_var = new ['String'] some_var = 'a string PMC' set_hll_global [ 'Foo'; 'Bar' ], 'a_var', some_var .end @@ -1111,7 +1111,7 @@ .param pmc other_names :slurpy .local pmc key - key = new 'Key' + key = new ['Key'] key = name .local int elem @@ -1206,15 +1206,15 @@ root_ns = get_namespace .local pmc child_ns - child_ns = new 'NameSpace' + child_ns = new ['NameSpace'] root_ns.'add_namespace'( 'Nested', child_ns ) .local pmc grandchild_ns - grandchild_ns = new 'NameSpace' + grandchild_ns = new ['NameSpace'] child_ns.'add_namespace'( 'Grandkid', grandchild_ns ) .local pmc great_grandchild_ns - great_grandchild_ns = new 'NameSpace' + great_grandchild_ns = new ['NameSpace'] grandchild_ns.'add_namespace'( 'Greatgrandkid', great_grandchild_ns ) .local pmc parent @@ -1251,7 +1251,7 @@ ns_child = subclass 'NameSpace', 'NSChild' .local pmc child - child = new 'NSChild' + child = new ['NSChild'] .local pmc root_ns root_ns = get_namespace @@ -1259,7 +1259,7 @@ root_ns.'add_namespace'( 'Really nested', child ) .local pmc not_a_ns - not_a_ns = new 'Integer' + not_a_ns = new ['Integer'] push_eh _invalid_ns root_ns.'add_namespace'( 'Nested', not_a_ns ) @@ -1342,7 +1342,7 @@ e_child = subclass 'Closure', 'ClosureChild' .local pmc child - child = new 'SubChild' + child = new ['SubChild'] .local pmc root_ns root_ns = get_namespace @@ -1350,24 +1350,24 @@ root_ns.'add_sub'( 'child', child ) print "Added sub child\n" - child = new 'Closure' + child = new ['Closure'] root_ns.'add_sub'( 'closure', child ) print "Added closure\n" - child = new 'Coroutine' + child = new ['Coroutine'] root_ns.'add_sub'( 'coroutine', child ) print "Added coroutine\n" - child = new 'Eval' + child = new ['Eval'] root_ns.'add_sub'( 'eval', child ) print "Added eval\n" - child = new 'ClosureChild' + child = new ['ClosureChild'] root_ns.'add_sub'( 'closure_child', child ) print "Added closure child\n" .local pmc not_a_sub - not_a_sub = new 'Integer' + not_a_sub = new ['Integer'] push_eh _invalid_sub root_ns.'add_sub'( 'Nested', not_a_sub ) @@ -1396,11 +1396,11 @@ .sub 'main' :main .local pmc foo - foo = new 'String' + foo = new ['String'] foo = 'Foo' .local pmc bar - bar = new 'String' + bar = new ['String'] bar = 'Bar' .local pmc key @@ -1521,7 +1521,7 @@ .sub main :main .local pmc not_a_ns - not_a_ns = new 'Array' + not_a_ns = new ['Array'] set_global 'Not_A_NS', not_a_ns @@ -1612,7 +1612,7 @@ pir_output_like( <<'CODE', <<'OUTPUT', 'del_sub() with error' ); .sub main :main .local pmc not_a_ns - not_a_ns = new 'Array' + not_a_ns = new ['Array'] set_global 'Not_A_Sub', not_a_ns @@ -1639,11 +1639,11 @@ pir_output_is( <<"CODE", <<'OUTPUT', 'del_var()' ); .sub 'main' :main .local pmc foo - foo = new 'String' + foo = new ['String'] foo = 'Foo' .local pmc bar - bar = new 'String' + bar = new ['String'] bar = 'Bar' set_global [ 'Parent' ], 'Foo', foo @@ -1690,7 +1690,7 @@ pir_error_output_like( <<'CODE', <<'OUTPUT', 'overriding find_method()' ); .sub 'main' :main $P0 = newclass 'Override' - $P1 = new 'Override' + $P1 = new ['Override'] $P2 = find_method $P1, 'foo' .end @@ -1705,17 +1705,17 @@ pir_output_is( <<'CODE', <<OUT, "iterate through a NameSpace PMC, RT #39978" ); .sub main :main - $P0 = new 'String' + $P0 = new ['String'] $P0 = "Ook...BANG!\n" set_root_global [ "DUMMY"; "X"; "Y" ], "Explosion", $P0 - $P1 = new 'Integer' + $P1 = new ['Integer'] $P1 = 0 set_root_global [ "DUMMY"; "X"; "Y" ], "T0", $P0 .local pmc dummy_x_y_ns, iter dummy_x_y_ns = get_root_namespace [ "DUMMY"; "X"; "Y" ] - iter = new 'Iterator', dummy_x_y_ns + iter = new ['Iterator'], dummy_x_y_ns loop: unless iter goto loop_end $S0 = shift iter @@ -1732,7 +1732,7 @@ pir_error_output_like( <<'CODE', <<OUT, "NameSpace with no class, RT #55620" ); .sub 'main' :main - $P1 = new 'NameSpace' + $P1 = new ['NameSpace'] set_args '(0)', $P1 tailcallmethod $P1, 'bob' .end Modified: trunk/t/pmc/nci.t ============================================================================== --- trunk/t/pmc/nci.t (original) +++ trunk/t/pmc/nci.t Sat Jan 10 23:34:33 2009 @@ -164,7 +164,7 @@ # the contained structure pointer .local pmc nci_dlvar_double_decl - nci_dlvar_double_decl = new 'ResizablePMCArray' + nci_dlvar_double_decl = new ['ResizablePMCArray'] push nci_dlvar_double_decl, .DATATYPE_DOUBLE push nci_dlvar_double_decl, 0 push nci_dlvar_double_decl, 0 @@ -226,7 +226,7 @@ # the contained structure pointer .local pmc nci_dlvar_float_decl - nci_dlvar_float_decl = new 'ResizablePMCArray' + nci_dlvar_float_decl = new ['ResizablePMCArray'] push nci_dlvar_float_decl, .DATATYPE_FLOAT push nci_dlvar_float_decl, 0 push nci_dlvar_float_decl, 0 @@ -313,7 +313,7 @@ # the contained structure pointer .local pmc nci_p_out_decl - nci_p_out_decl = new 'ResizablePMCArray' + nci_p_out_decl = new ['ResizablePMCArray'] push nci_p_out_decl, .DATATYPE_INT push nci_p_out_decl, 0 push nci_p_out_decl, 0 @@ -406,7 +406,7 @@ # the contained structure pointer .local pmc nci_dlvar_int_decl - nci_dlvar_int_decl = new 'ResizablePMCArray' + nci_dlvar_int_decl = new ['ResizablePMCArray'] push nci_dlvar_int_decl, .DATATYPE_INT push nci_dlvar_int_decl, 0 push nci_dlvar_int_decl, 0 @@ -761,7 +761,7 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "nci_i4i" ); loadlib P1, "libnci_test" dlfunc P0, P1, "nci_i4i", "i4i" - new P5, 'Integer' + new P5, ['Integer'] set P5, -6 set I5, -7 set_args "0,0", P5,I5 @@ -780,7 +780,7 @@ dlfunc P0, P1, "nci_ii3", "ii3" set I5, -6 - new P5, 'Integer' + new P5, ['Integer'] set P5, -7 set_args "0,0", I5,P5 @@ -831,7 +831,7 @@ set_args "0", I5 get_results "0", P5 invokecc P0 - new P2, 'ResizablePMCArray' + new P2, ['ResizablePMCArray'] .include "datatypes.pasm" push P2, .DATATYPE_INT push P2, 2 # 2 elem array @@ -863,7 +863,7 @@ set_args "0", 1 get_results "0", P5 invokecc P0 - new P2, 'ResizablePMCArray' + new P2, ['ResizablePMCArray'] .include "datatypes.pasm" push P2, .DATATYPE_FLOAT push P2, 2 # 2 elem array @@ -895,7 +895,7 @@ set_args "0", 2 get_results "0", P5 invokecc P0 - new P2, 'ResizablePMCArray' + new P2, ['ResizablePMCArray'] .include "datatypes.pasm" push P2, .DATATYPE_CHAR push P2, 0 @@ -929,7 +929,7 @@ set_args "0", 3 get_results "0", P5 invokecc P0 - new P2, 'ResizablePMCArray' + new P2, ['ResizablePMCArray'] .include "datatypes.pasm" push P2, .DATATYPE_CSTR push P2, 0 @@ -959,7 +959,7 @@ invokecc P0 .include "datatypes.pasm" # the contained structure - new P3, 'ResizablePMCArray' + new P3, ['ResizablePMCArray'] push P3, .DATATYPE_INT push P3, 0 push P3, 0 @@ -969,9 +969,9 @@ push P3, .DATATYPE_DOUBLE push P3, 0 push P3, 0 - new P4, 'UnManagedStruct', P3 + new P4, ['UnManagedStruct'], P3 # outer structure - new P2, 'ResizablePMCArray' + new P2, ['ResizablePMCArray'] push P2, .DATATYPE_CHAR push P2, 0 push P2, 0 @@ -1020,7 +1020,7 @@ set P6[ 'j' ], .DATATYPE_INT push P6, 0 push P6, 0 - new P7, 'UnManagedStruct', P6 + new P7, ['UnManagedStruct'], P6 # the contained structure new P3, 'OrderedHash' set P3[ 'i' ], .DATATYPE_INT @@ -1034,9 +1034,9 @@ setprop P1, "_struct", P7 push P3, 0 push P3, 0 - new P4, 'UnManagedStruct', P3 + new P4, ['UnManagedStruct'], P3 # outer structure - new P2, 'OrderedHash' + new P2, ['OrderedHash'] set P2[ 'x' ], .DATATYPE_INT push P2, 0 push P2, 0 @@ -1082,12 +1082,12 @@ set_args "0", 5 get_results "0", P5 invokecc P0 - new P2, 'ResizablePMCArray' + new P2, ['ResizablePMCArray'] .include "datatypes.pasm" push P2, .DATATYPE_FUNC_PTR # attach function signature property to this type set P1, P2[-1] - new P3, 'String' + new P3, ['String'] set P3, "it" setprop P1, "_signature", P3 push P2, 0 @@ -1115,16 +1115,16 @@ invokecc P0 .include "datatypes.pasm" # the nested structure - new P3, 'ResizablePMCArray' + new P3, ['ResizablePMCArray'] push P3, .DATATYPE_INT push P3, 0 push P3, 0 push P3, .DATATYPE_INT push P3, 0 push P3, 0 - new P4, 'UnManagedStruct', P3 + new P4, ['UnManagedStruct'], P3 # outer structure - new P2, 'ResizablePMCArray' + new P2, ['ResizablePMCArray'] push P2, .DATATYPE_INT push P2, 0 push P2, 0 @@ -1170,16 +1170,16 @@ invokecc P0 .include "datatypes.pasm" # the nested structure - new P3, 'ResizablePMCArray' + new P3, ['ResizablePMCArray'] push P3, .DATATYPE_CHAR push P3, 0 push P3, 0 push P3, .DATATYPE_INT push P3, 0 push P3, 0 - new P4, 'UnManagedStruct', P3 + new P4, ['UnManagedStruct'], P3 # outer structure - new P2, 'ResizablePMCArray' + new P2, ['ResizablePMCArray'] push P2, .DATATYPE_CHAR push P2, 0 push P2, 0 @@ -1225,16 +1225,16 @@ invokecc P0 .include "datatypes.pasm" # the nested structure - new P3, 'OrderedHash' + new P3, ['OrderedHash'] set P3["i"], .DATATYPE_CHAR push P3, 0 push P3, 0 set P3["j"], .DATATYPE_INT push P3, 0 push P3, 0 - new P4, 'UnManagedStruct', P3 + new P4, ['UnManagedStruct'], P3 # outer structure - new P2, 'OrderedHash' + new P2, ['OrderedHash'] set P2["x"], .DATATYPE_CHAR push P2, 0 push P2, 0 @@ -1291,7 +1291,7 @@ # the contained structure pointer .local pmc nci_pi_out_decl - nci_pi_out_decl = new 'ResizablePMCArray' + nci_pi_out_decl = new ['ResizablePMCArray'] push nci_pi_out_decl, .DATATYPE_INT push nci_pi_out_decl, 0 push nci_pi_out_decl, 0 @@ -1314,7 +1314,7 @@ # this test function wants a struct # { double d; float f; int i; char*} # and returns the sum of these values - new P2, 'ResizablePMCArray' + new P2, ['ResizablePMCArray'] .include "datatypes.pasm" push P2, .DATATYPE_DOUBLE push P2, 0 @@ -1328,7 +1328,7 @@ push P2, .DATATYPE_CSTR push P2, 0 # 1 elem array push P2, 0 - new P5, 'ManagedStruct', P2 + new P5, ['ManagedStruct'], P2 set I6, 0 sizeof I7, .DATATYPE_DOUBLE add I6, I7 @@ -1358,7 +1358,7 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "nci_vP" ); loadlib P1, "libnci_test" dlfunc P0, P1, "nci_vP", "vP" - new P5, 'String' + new P5, ['String'] set P5, "ok\n" set_args "0", P5 invokecc P0 @@ -1378,12 +1378,12 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "nci_cb_C1 - PASM", @todo ); # we need a flag if the call_back is already done - new P10, 'Integer' + new P10, ['Integer'] set_global "cb_done", P10 # first attempt - create cb manually (this step will be hidden later) .const 'Sub' P6 = "_call_back" # prepare user data - new P7, 'Integer' + new P7, ['Integer'] set P7, 42 new_callback P5, P6, P7, "vtU" # Z in pdd16 print "ok 1\n" @@ -1440,13 +1440,13 @@ # this flag will be set by the callback function .local pmc cb_done - cb_done = new 'Integer' + cb_done = new ['Integer'] cb_done = 0 set_global "cb_done", cb_done # prepare user data .local pmc user_data - user_data = new 'Integer' + user_data = new ['Integer'] user_data = 42 # A Sub that can be given to the library @@ -1510,12 +1510,12 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "nci_cb_C2 - PASM", @todo ); # we need a flag if the call_back is already done - new P10, 'Integer' + new P10, ['Integer'] set_global "cb_done", P10 # first attempt - create cb manually (this step will be hidden later) .const 'Sub' P6 = "_call_back" # prepare user data - new P7, 'Integer' + new P7, ['Integer'] set P7, 42 new_callback P5, P6, P7, "viU" # Z in pdd16 print "ok 1\n" @@ -1576,13 +1576,13 @@ # this flag will be set by the callback function .local pmc cb_done - cb_done = new 'Integer' + cb_done = new ['Integer'] cb_done = 0 set_global "cb_done", cb_done # prepare user data .local pmc user_data - user_data = new 'Integer' + user_data = new ['Integer'] user_data = 42 # A Sub that can be given to the library @@ -1628,7 +1628,7 @@ print "\n" # P6 is a UnManagedStruct PMC containing a pointer to an integer - new $P2, 'ResizablePMCArray' + new $P2, ['ResizablePMCArray'] push $P2, .DATATYPE_INT push $P2, 0 push $P2, 0 @@ -1657,12 +1657,12 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "nci_cb_D1 - PASM", @todo ); # we need a flag if the call_back is already done - new P10, 'Integer' + new P10, ['Integer'] set_global "cb_done", P10 # first attempt - create cb manually (this step will be hidden later) .const 'Sub' P6 = "_call_back" # prepare user data - new P7, 'Integer' + new P7, ['Integer'] set P7, 42 new_callback P5, P6, P7, "vUt" # Z in pdd16 print "ok 1\n" @@ -1715,12 +1715,12 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "nci_cb_D2 - PASM", @todo ); # we need a flag if the call_back is already done - new P10, 'Integer' + new P10, ['Integer'] set_global "cb_done", P10 # first attempt - create cb manually (this step will be hidden later) .const 'Sub' P6 = "_call_back" # prepare user data - new P7, 'Integer' + new P7, ['Integer'] set P7, 42 new_callback P5, P6, P7, "vUi" # Z in pdd16 print "ok 1\n" @@ -1778,13 +1778,13 @@ # this flag will be set by the callback function .local pmc cb_done - cb_done = new 'Integer' + cb_done = new ['Integer'] cb_done = 0 set_global "cb_done", cb_done # prepare user data .local pmc user_data - user_data = new 'Integer' + user_data = new ['Integer'] user_data = 42 # A Sub that can be given to the library @@ -1855,13 +1855,13 @@ # this flag will be set by the callback function .local pmc cb_done - cb_done = new 'Integer' + cb_done = new ['Integer'] cb_done = 0 set_global "cb_done", cb_done # prepare user data .local pmc user_data - user_data = new 'Integer' + user_data = new ['Integer'] user_data = 42 # A Sub that can be given to the library @@ -1908,7 +1908,7 @@ print "\n" # s is a UnManagedStruct PMC containing a pointer to an integer - new $P2, 'ResizablePMCArray' + new $P2, ['ResizablePMCArray'] push $P2, .DATATYPE_INT push $P2, 0 push $P2, 0 @@ -1945,7 +1945,7 @@ bounds 1 # prepare user data .local pmc user_data - user_data = new 'Integer' + user_data = new ['Integer'] user_data = 42 # load libnci_test @@ -1956,7 +1956,7 @@ .local pmc int_cb_D4 int_cb_D4 = dlvar libnci_test, "int_cb_D4" .local pmc int_cb_D4_decl - int_cb_D4_decl = new 'ResizablePMCArray' + int_cb_D4_decl = new ['ResizablePMCArray'] push int_cb_D4_decl, .DATATYPE_INT push int_cb_D4_decl, 0 push int_cb_D4_decl, 0 @@ -1980,7 +1980,7 @@ int_cb_D4[0] = 1 .local pmc synchronous - synchronous = new 'Integer' + synchronous = new ['Integer'] synchronous = 1 setprop user_data, "_synchronous", synchronous print "marked callback as synchronous\n" @@ -1993,7 +1993,7 @@ .param pmc u .param pmc s # s is a UnManagedStruct PMC containing a pointer to an integer - new $P2, 'ResizablePMCArray' + new $P2, ['ResizablePMCArray'] push $P2, .DATATYPE_INT push $P2, 0 push $P2, 0 @@ -2036,7 +2036,7 @@ pasm_output_is( <<'CODE', <<'OUTPUT', 'nci_pip - array of structs' ); .include "datatypes.pasm" - new P3, 'OrderedHash' + new P3, ['OrderedHash'] set P3["x"], .DATATYPE_INT push P3, 0 push P3, 0 @@ -2049,16 +2049,16 @@ set P3["h"], .DATATYPE_INT push P3, 0 push P3, 0 - new P6, 'UnManagedStruct', P3 + new P6, ['UnManagedStruct'], P3 - new P4, 'OrderedHash' + new P4, ['OrderedHash'] set P4["Rect"], .DATATYPE_STRUCT set P1, P4[-1] setprop P1, "_struct", P6 push P4, 4 push P4, 0 - new P5, 'ManagedStruct', P4 + new P5, ['ManagedStruct'], P4 set P5[0;0;'x'], 100 set P5[0;0;'y'], 110 set P5['Rect';0;'w'], 120 @@ -2108,9 +2108,9 @@ pasm_output_is( <<'CODE', <<'OUTPUT', 'nci_i33 - out parameters and return values' ); .include "datatypes.pasm" - new P2, 'Integer' + new P2, ['Integer'] set P2, 3 - new P3, 'Integer' + new P3, ['Integer'] set P3, 2 loadlib P1, "libnci_test" @@ -2212,7 +2212,7 @@ set P7[ 'array' ], .DATATYPE_INT push P7, 0 push P7, 0 - new P8, 'UnManagedStruct', P7 + new P8, ['UnManagedStruct'], P7 # yes, the array within the struct has _4_ elements # but with an UnManagedStruct, you can't always know the amount beforehand set P6[ 'array' ], .DATATYPE_STRUCT_PTR @@ -2275,7 +2275,7 @@ # the contained structure pointer .local pmc product_pointer_decl - product_pointer_decl = new 'ResizablePMCArray' + product_pointer_decl = new ['ResizablePMCArray'] push product_pointer_decl, .DATATYPE_INT push product_pointer_decl, 0 push product_pointer_decl, 0 @@ -2334,7 +2334,7 @@ # the contained structure pointer .local pmc nci_dlvar_int_decl - nci_dlvar_int_decl = new 'ResizablePMCArray' + nci_dlvar_int_decl = new ['ResizablePMCArray'] push nci_dlvar_int_decl, .DATATYPE_INT push nci_dlvar_int_decl, 0 push nci_dlvar_int_decl, 0 @@ -2460,7 +2460,7 @@ .sub test :main .local pmc pmc1 - pmc1 = new 'ParrotLibrary' + pmc1 = new ['ParrotLibrary'] .local int bool1 does bool1, pmc1, "scalar" print bool1 @@ -2488,7 +2488,7 @@ .local pmc twice twice = dlfunc libnci_test, "nci_dd", "dd" .local pmc f, g - f = new 'Integer' + f = new ['Integer'] f = 21 g = twice( f ) print g @@ -2507,7 +2507,7 @@ .local pmc reverse reverse = dlfunc libnci_test, "nci_tt", "tt" .local pmc s, t - s = new 'String' + s = new ['String'] s = "ko" t = reverse( s ) print t @@ -2525,7 +2525,7 @@ .local pmc mult mult = dlfunc libnci_test, "nci_i4i", "i4i" .local pmc i, j - i = new 'Integer' + i = new ['Integer'] i = 2 j = mult( 21, i ) # call signature is PI print j @@ -2547,13 +2547,13 @@ libnci_test = loadlib library_name .local pmc types - types = new 'OrderedHash' + types = new ['OrderedHash'] types['y'] = .DATATYPE_INT push types, 0 push types, 0 .local pmc nested - nested = new 'ManagedStruct', types + nested = new ['ManagedStruct'], types .local pmc outer outer = make_outer_struct( nested ) @@ -2593,7 +2593,7 @@ .param pmc nested .local pmc types - types = new 'OrderedHash' + types = new ['OrderedHash'] types[ 'x' ] = .DATATYPE_INT push types, 0 push types, 0 @@ -2606,7 +2606,7 @@ push types, 0 .local pmc outer - outer = new 'ManagedStruct', types + outer = new ['ManagedStruct'], types .return( outer ) .end @@ -2659,7 +2659,7 @@ nci_vp = dlfunc libnci_test, "nci_vp", "vp" .local pmc opaque - opaque = new 'Pointer' + opaque = new ['Pointer'] $I0 = 10 nci_vVi(opaque, $I0) nci_vp(opaque) @@ -2715,7 +2715,7 @@ nci_vV = dlfunc libnci_test, "nci_vV", "vV" .local pmc char_s_s - char_s_s = new 'Pointer' + char_s_s = new ['Pointer'] nci_vV(char_s_s) $S0 = char_s_s print $S0 Modified: trunk/t/pmc/null.t ============================================================================== --- trunk/t/pmc/null.t (original) +++ trunk/t/pmc/null.t Sat Jan 10 23:34:33 2009 @@ -21,8 +21,8 @@ plan(1) - new $P0, 'Null' - ok(1, 'Instantiated .Null') + new $P0, ['Null'] + ok(1, 'Instantiated a Null PMC') .end # Local Variables: Modified: trunk/t/pmc/object-meths.t ============================================================================== --- trunk/t/pmc/object-meths.t (original) +++ trunk/t/pmc/object-meths.t Sat Jan 10 23:34:33 2009 @@ -89,7 +89,7 @@ .sub main :main $P2 = newclass "Foo" - $P3 = new "Sub" + $P3 = new ['Sub'] # Add a method to the class manually $P2.'add_method'("meth", $P3) @@ -106,9 +106,9 @@ pir_output_is( <<'CODE', <<'OUTPUT', "can object" ); .sub main :main $P2 = newclass "Foo" - $P4 = new "Foo" + $P4 = new ['Foo'] - $P3 = new "Sub" + $P3 = new ['Sub'] # Add a method to the class manually $P2.'add_method'("meth", $P3) @@ -128,7 +128,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "constructor" ); .sub main :main $P1 = newclass "Foo" - new $P3, "Foo" + new $P3, ['Foo'] print "ok 2\n" end .end @@ -145,7 +145,7 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "constructor - init attr" ); newclass P1, "Foo" addattribute P1, ".i" - new P3, "Foo" + new P3, ['Foo'] print "ok 2\n" print P3 print "\n" @@ -154,7 +154,7 @@ .pcc_sub __init: get_params "0", P2 print "ok 1\n" - new P10, 'Integer' + new P10, ['Integer'] set P10, 42 setattribute P2, ".i", P10 set_returns "" @@ -174,8 +174,8 @@ newclass P1, "Foo" subclass P2, P1, "Bar" subclass P3, P2, "Baz" - new P3, "Baz" - new P3, "Bar" + new P3, ['Baz'] + new P3, ['Bar'] get_global P0, "_sub" invokecc P0 print "done\n" @@ -228,8 +228,8 @@ newclass A, "A" newclass B, "B" - new A, "A" - new B, "B" + new A, ['A'] + new B, ['B'] setprop A, "B", B @@ -283,8 +283,8 @@ newclass A, "A" newclass B, "B" - new A, "A" - new B, "B" + new A, ['A'] + new B, ['B'] A."foo"(B) B."foo"() @@ -335,8 +335,8 @@ newclass A, "A" newclass B, "B" - new A, "A" - new B, "B" + new A, ['A'] + new B, ['B'] .local pmc r r = A."foo"(B) @@ -391,7 +391,7 @@ newclass P0, "Foo" print "new\n" - new P2, "Foo" + new P2, ['Foo'] eh: print "back in main\n" end @@ -414,7 +414,7 @@ pasm_output_is( <<'CODE', <<'OUTPUT', "find_method" ); newclass P3, "Foo" - new P2, "Foo" + new P2, ['Foo'] set S0, "meth" find_method P0, P2, S0 @@ -465,7 +465,7 @@ bsr _check_isa print "new F\n" - new P16, "F" + new P16, ['F'] print "done\n" end @@ -589,7 +589,7 @@ .sub main :main $P0 = newclass 'Foo' $P1 = subclass 'Foo', 'Bar' - $P2 = new 'Bar' + $P2 = new ['Bar'] .end .namespace ['Foo'] @@ -639,7 +639,7 @@ .local pmc A newclass A, "A" - new A, "A" + new A, ['A'] A."foo"() end .end @@ -662,7 +662,7 @@ .sub _main newclass $P0, "Foo" - new $P1, "Foo" + new $P1, ['Foo'] $I1 = $P1["foo"] @@ -691,7 +691,7 @@ .sub _main newclass $P0, "Foo" - new $P1, "Foo" + new $P1, ['Foo'] $I1 = $P1["foo"] @@ -725,7 +725,7 @@ .local pmc o, cl newclass cl, "Foo" subclass cl, cl, "Bar" - o = new "Bar" + o = new ['Bar'] print o $P0 = get_global "ok2" cl.'add_method'('get_string', $P0, 'vtable' => 1) @@ -775,7 +775,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "bound NCI method" ); .sub main :main .local pmc s, l, f - s = new 'String' + s = new ['String'] s = "ABC\n" f = getattribute s, "lower" typeof $S0, f @@ -795,8 +795,8 @@ .local pmc cl, o, n cl = newclass "Foo" addattribute cl, "n" - o = new "Foo" - n = new 'Integer' + o = new ['Foo'] + n = new ['Integer'] n = 2000 setattribute o, [ "Foo" ], "n", n o.'go'() @@ -822,7 +822,7 @@ .sub main :main .local pmc cl, o cl = subclass "String", "MyString" - o = new "MyString" + o = new ['MyString'] o = "foo" print o print "\n" @@ -843,7 +843,7 @@ .sub main :main .local pmc cl, o cl = newclass "MyClass" - o = new "MyClass" + o = new ['MyClass'] $I0 = 5 $S0 = "foo" o[$I0] = 42 @@ -919,7 +919,7 @@ .sub main :main .local pmc cl, o cl = subclass "ResizablePMCArray", "MyClass" - o = new "MyClass" + o = new ['MyClass'] $I0 = 5 o[$I0] = 42 $I1 = o[$I0] @@ -957,7 +957,7 @@ .sub main :main .local pmc cl, o cl = subclass "ResizablePMCArray", "MyClass" - o = new "MyClass" + o = new ['MyClass'] $I0 = 5 o[$I0] = 42 $I1 = o[$I0] @@ -1002,7 +1002,7 @@ .sub main :main .local pmc cl, o cl = subclass 'Integer', 'MyInt' - o = new 'MyInt' + o = new ['MyInt'] o = 10 $S0 = o.'get_as_base'(16) print $S0 @@ -1016,9 +1016,9 @@ .sub main :main .local pmc cl, o cl = newclass 'MyClass' - o = new 'MyClass' - $P0 = new 'String' - o = new 'MyClass', $P0 + o = new ['MyClass'] + $P0 = new ['String'] + o = new ['MyClass'], $P0 .end .namespace ['MyClass'] @@ -1041,7 +1041,7 @@ .sub main :main .local pmc cl, o cl = newclass 'MyClass' - o = new 'MyClass' + o = new ['MyClass'] o.'foo'() .end @@ -1067,8 +1067,8 @@ .sub main :main .local pmc cl, o cl = newclass 'MyClass' - o = new 'MyClass' - $P2 = new 'String' + o = new ['MyClass'] + $P2 = new ['String'] $P2 = "blue" setattribute o, "blue", $P2 $P1 = getattribute o, "blue" @@ -1094,7 +1094,7 @@ .sub main :main .local pmc cl, o, cl2 cl = newclass 'MyClass' - o = new 'MyClass' + o = new ['MyClass'] cl2 = class o .end Modified: trunk/t/pmc/object-mro.t ============================================================================== --- trunk/t/pmc/object-mro.t (original) +++ trunk/t/pmc/object-mro.t Sat Jan 10 23:34:33 2009 @@ -44,7 +44,7 @@ subclass F, C, "F" addparent F, D mro = F.'inspect'('all_parents') - it = new 'Iterator', mro + it = new ['Iterator'], mro it = 0 loop: unless it goto ex @@ -113,7 +113,7 @@ .local pmc mro, it, p mro = A.'inspect'('all_parents') - it = new 'Iterator', mro + it = new ['Iterator'], mro it = 0 loop: unless it goto ex @@ -183,7 +183,7 @@ .local pmc mro, it, p mro = A.'inspect'('all_parents') - it = new 'Iterator', mro + it = new ['Iterator'], mro it = 0 loop: unless it goto ex @@ -220,7 +220,7 @@ .local pmc mro, it, p mro = D.'inspect'('all_parents') - it = new 'Iterator', mro + it = new ['Iterator'], mro it = 0 loop: unless it goto ex @@ -279,7 +279,7 @@ .local pmc mro, it, p mro = Vulcan.'inspect'('all_parents') - it = new 'Iterator', mro + it = new ['Iterator'], mro it = 0 loop: unless it goto ex Modified: trunk/t/pmc/object.t ============================================================================== --- trunk/t/pmc/object.t (original) +++ trunk/t/pmc/object.t Sat Jan 10 23:34:33 2009 @@ -20,12 +20,12 @@ ## TODO add more tests as this is documented and implemented .sub main :main - .include 'include/test_more.pir' + .include 'test_more.pir' plan(1) push_eh cant_instantiate - new $P0, 'Object' + new $P0, ['Object'] pop_eh ok(0, 'Able to instantiate Object') goto done_1 Modified: trunk/t/pmc/objects.t ============================================================================== --- trunk/t/pmc/objects.t (original) +++ trunk/t/pmc/objects.t Sat Jan 10 23:34:33 2009 @@ -129,7 +129,7 @@ .end .sub test_isa - new $P1, 'Boolean' + new $P1, ['Boolean'] isa $I0, $P1, "Boolean" is( $I0, 1, 'Boolean isa Boolean' ) @@ -168,7 +168,7 @@ .end .sub does_scalar - new $P1, 'Boolean' + new $P1, ['Boolean'] does $I0, $P1, "Boolean" is( $I0, 0, 'Boolean !does Boolean' ) @@ -181,7 +181,7 @@ .end .sub does_array - new $P1, 'OrderedHash' + new $P1, ['OrderedHash'] does $I0, $P1, "Boolean" is( $I0, 0, 'OrderedHash !does Boolean' ) @@ -347,16 +347,16 @@ .namespace ['Bar32'] .sub init :vtable :method - $P0 = new 'String' + $P0 = new ['String'] $P0 = 'Foo32.i' setattribute self, ['Foo32'], "i", $P0 - $P0 = new 'String' + $P0 = new ['String'] $P0 = 'Foo32.j' setattribute self, ["Foo32"], "j", $P0 - $P0 = new 'String' + $P0 = new ['String'] $P0 = 'Bar32.j' setattribute self, ["Bar32"], "j", $P0 - $P0 = new 'String' + $P0 = new ['String'] $P0 = 'Bar32.k' setattribute self, ["Bar32"], "k", $P0 .end @@ -368,11 +368,11 @@ addattribute $P1, "i" new $P2, $P1 - new $P3, 'Integer' + new $P3, ['Integer'] set $P3, 1024 setattribute $P2, "i", $P3 - new $P4, 'Integer' + new $P4, ['Integer'] getattribute $P4, $P2, "i" is( $P4, 1024, 'set/get Integer attribute' ) @@ -384,9 +384,9 @@ addattribute $P1, "j" new $P2, "Foo14" - new $P3, 'Integer' + new $P3, ['Integer'] set $P3, 4201 - new $P4, 'Hash' + new $P4, ['Hash'] set $P4["Key"], "Value" setattribute $P2, "i", $P3 @@ -406,10 +406,10 @@ new $P2, $P1 new $P3, $P1 - new $P4, 'Integer' + new $P4, ['Integer'] set $P4, 100 setattribute $P2, "i", $P4 - new $P5, 'String' + new $P5, ['String'] set $P5, "One hundred" setattribute $P3, "i", $P5 @@ -434,13 +434,13 @@ # Note that setattribute holds the actual PMC, not a copy, so # in this test both attributes get the PMC from $P4, and should # both have the same value, despite the C<inc>. - new $P4, 'Integer' + new $P4, ['Integer'] set $P4, 10 setattribute $P2, "i", $P4 inc $P4 setattribute $P2, "j", $P4 - new $P5, 'Integer' + new $P5, ['Integer'] set $P5, 100 setattribute $P3, "i", $P5 inc $P5 @@ -479,19 +479,19 @@ new $P3, "Bar17" # Set the attribute values - new $P10, 'String' # set attribute values + new $P10, ['String'] # set attribute values set $P10, "i" # attribute slots have reference semantics setattribute $P3, ".i", $P10 # so always put new PMCs in # if you have unique values - new $P10, 'String' + new $P10, ['String'] set $P10, "j" setattribute $P3, ".j", $P10 - new $P10, 'String' + new $P10, ['String'] set $P10, "k" setattribute $P3, ".k", $P10 - new $P10, 'String' + new $P10, ['String'] set $P10, "l" setattribute $P3, ".l", $P10 @@ -524,7 +524,7 @@ is( k, 13, 'added two MyInt1' ) - j = new 'Integer' + j = new ['Integer'] j = 100 k = i + j @@ -558,8 +558,8 @@ newclass $P0, "A" newclass $P1, "B" - new $P0, "A" - new $P1, "B" + new $P0, ['A'] + new $P1, ['B'] typeof $S0, $P0 typeof $S1, $P1 @@ -578,13 +578,13 @@ subclass $P3, $P1, "Sun" addparent $P3, $P2 - new $P4, "Sun" + new $P4, ['Sun'] - new $P5, 'String' + new $P5, ['String'] set $P5, "G" setattribute $P4, "Spectral Type", $P5 - new $P6, 'String' + new $P6, ['String'] set $P6, "$100,000,000" setattribute $P4, "Annual Profit", $P6 @@ -608,7 +608,7 @@ new $P4, "Sun2" - new $P5, 'String' + new $P5, ['String'] set $P5, "Taurus" setattribute $P4, "Location", $P5 getattribute $P6, $P4, "Location" @@ -635,7 +635,7 @@ newclass $P1, "Foo18" addattribute $P1, "i" new $P2, "Foo18" - new $P3, 'String' + new $P3, ['String'] set $P3, "ok" setattribute $P2, "i", $P3 @@ -652,11 +652,11 @@ new $P2, "Foo19" - new $P3, 'String' + new $P3, ['String'] set $P3, "foo i" setattribute $P2, "i", $P3 - new $P3, 'String' + new $P3, ['String'] set $P3, "bar j" setattribute $P2, "j", $P3 @@ -676,11 +676,11 @@ new $P2, "Foo20" - new $P3, 'String' + new $P3, ['String'] set $P3, "foo i" setattribute $P2, ["Foo20"], "i", $P3 - new $P3, 'String' + new $P3, ['String'] set $P3, "bar j" setattribute $P2, ["Bar20"], "j", $P3 @@ -743,7 +743,7 @@ .local pmc i, i2 i = new "MyInt5" - i2 = new "Integer" + i2 = new ['Integer'] i2 = 43 i = 42 # set_integer is inherited from Integer @@ -760,7 +760,7 @@ .sub set_integer_native :vtable :method .param int new_value - $P1 = new 'Integer' + $P1 = new ['Integer'] $P1 = new_value setattribute self, "intval", $P1 .end @@ -848,7 +848,7 @@ .namespace ["MyInt8"] .sub 'set_integer_native' :vtable :method .param int val - $P1 = new 'Integer' + $P1 = new ['Integer'] $P1 = val setattribute self, "intval", $P1 .return () @@ -910,7 +910,7 @@ .namespace ["MyInt9"] .sub 'set_integer_native' :vtable :method .param int val - $P1 = new 'Integer' + $P1 = new ['Integer'] $P1 = val setattribute self, "intval", $P1 .return () @@ -979,7 +979,7 @@ .namespace ['MyInt10'] .sub 'set_integer_native' :vtable :method .param int val - $P1 = new 'Integer' + $P1 = new ['Integer'] $P1 = val setattribute self, "intval", $P1 .return () @@ -1097,19 +1097,19 @@ new $P2, "Bar22" # set a bunch of attribs - new $P4, 'Integer' + new $P4, ['Integer'] set $P4, 10 setattribute $P2, "i", $P4 - new $P4, 'Integer' + new $P4, ['Integer'] set $P4, 11 setattribute $P2, "j", $P4 - new $P4, 'Integer' + new $P4, ['Integer'] set $P4, 20 setattribute $P2, "k", $P4 - new $P4, 'Integer' + new $P4, ['Integer'] set $P4, 21 setattribute $P2, "l", $P4 @@ -1137,8 +1137,8 @@ a = getattribute o, "a" is( a, 'ok 1', 'init without an arg' ) - h = new 'Hash' - $P0 = new 'String' + h = new ['Hash'] + $P0 = new ['String'] $P0 = "ok 2" h['a'] = $P0 o = new cl, h @@ -1154,7 +1154,7 @@ .return() .end .sub init :vtable :method - $P0 = new 'String' + $P0 = new ['String'] $P0 = "ok 1" setattribute self, 'a', $P0 .end @@ -1206,7 +1206,7 @@ .sub init :vtable :method .local pmc p - p = new 'Integer' + p = new ['Integer'] p = 999 setattribute self, "init_check", p .end @@ -1418,7 +1418,7 @@ isnull $I1, $P0 ok( $I1, 'should be null' ) - $P1 = new "Integer" + $P1 = new ['Integer'] setattribute self, "i", $P1 # i won't be null if init called again .return () .end @@ -1458,7 +1458,7 @@ newclass $P1, "Foo45" new $P2, $P1 - new $P3, 'Integer' + new $P3, ['Integer'] push_eh handler setattribute $P2, "bar", $P3 pop_eh @@ -1473,7 +1473,7 @@ newclass $P1, "Foo47" new $P2, $P1 - new $P3, 'Integer' + new $P3, ['Integer'] push_eh handler setattribute $P2, ["Foo47"], "no_such", $P3 pop_eh @@ -1511,7 +1511,7 @@ .sub addparent_exceptions_1 newclass $P0, "Astronomical Object 2" - new $P1, 'String' + new $P1, ['String'] set $P1, "Not a class" push_eh handler addparent $P0, $P1 @@ -1524,7 +1524,7 @@ .end .sub addparent_exceptions_2 - new $P0, 'Hash' + new $P0, ['Hash'] newclass $P1, "Trashcan" push_eh handler addparent $P0, $P1 @@ -1574,7 +1574,7 @@ .sub wrong_way_to_create_new_objects push_eh handler - new $P0, 'Object' + new $P0, ['Object'] pop_eh ok(0, "object instantiation exception not thrown") goto end @@ -1606,25 +1606,25 @@ new $P13, "Bar54" # Foo54 and Bar54 have attribute accessor methods - new $P5, 'String' # set attribute values + new $P5, ['String'] # set attribute values set $P5, "i" # attribute slots have reference semantics set_args "0,0", $P5, "i" get_results "" callmethodcc $P13, "Foo54__set" - new $P5, 'String' + new $P5, ['String'] set $P5, "j" set_args "0,0", $P5, "j" get_results "" callmethodcc $P13,"Foo54__set" - new $P5, 'String' + new $P5, ['String'] set $P5, "k" set_args "0,0", $P5, "k" get_results "" callmethodcc $P13,"Bar54__set" - new $P5, 'String' + new $P5, ['String'] set $P5, "l" set_args "0,0", $P5, "l" get_results "" @@ -1716,31 +1716,31 @@ new $P2, "Bar56" # Foo56 and Bar56 have attribute accessor methods - new $P5, 'String' # set attribute values + new $P5, ['String'] # set attribute values set $P5, "i" # attribute slots have reference semantics set_args "0,0,0", $P5, "Foo56", "i" get_results "" callmethodcc $P2, "set" - new $P5, 'String' + new $P5, ['String'] set $P5, "j" set_args "0,0,0", $P5, "Foo56", "j" get_results "" callmethodcc $P2, "set" - new $P5, 'String' + new $P5, ['String'] set $P5, "k" set_args "0,0,0", $P5, "Bar56", "k" get_results "" callmethodcc $P2, "set" - new $P5, 'String' + new $P5, ['String'] set $P5, "l" set_args "0,0,0", $P5, "Bar56", "l" get_results "" callmethodcc $P2, "set" - new $P5, 'String' + new $P5, ['String'] set $P5, "m" set_args "0,0,0", $P5, "Bar56", "m" get_results "" Modified: trunk/t/pmc/orderedhash.t ============================================================================== --- trunk/t/pmc/orderedhash.t (original) +++ trunk/t/pmc/orderedhash.t Sat Jan 10 23:34:33 2009 @@ -23,7 +23,7 @@ =cut pasm_output_is( <<'CODE', <<OUT, "init" ); - new P0, 'OrderedHash' + new P0, ['OrderedHash'] print "ok 1\n" set I0, P0 eq I0, 0, ok2 @@ -36,14 +36,14 @@ OUT pasm_output_is( <<'CODE', <<OUT, "set keys, get idx" ); - new P0, 'OrderedHash' - new P1, 'String' + new P0, ['OrderedHash'] + new P1, ['String'] set P1, "ok 1\n" set P0["x"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 2\n" set P0["a"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 3\n" set P0["j"], P1 @@ -78,18 +78,18 @@ pasm_output_is( <<'CODE', <<OUT, "iterate" ); .include "iterator.pasm" - new P0, 'OrderedHash' - new P1, 'String' + new P0, ['OrderedHash'] + new P1, ['String'] set P1, "ok 1\n" set P0["x"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 2\n" set P0["a"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 3\n" set P0["j"], P1 - new P2, 'Iterator', P0 + new P2, ['Iterator'], P0 set P2, .ITERATE_FROM_START iter_loop: unless P2, end_iter @@ -116,11 +116,11 @@ OUT pasm_output_is( <<'CODE', <<OUT, "idx only" ); - new P0, 'OrderedHash' - new P1, 'String' + new P0, ['OrderedHash'] + new P1, ['String'] set P1, "ok 1\n" set P0[0], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 2\n" set P0[1], P1 @@ -135,14 +135,14 @@ OUT pasm_output_is( <<'CODE', <<OUT, "set keys, get idx - cloned" ); - new P10, 'OrderedHash' - new P1, 'String' + new P10, ['OrderedHash'] + new P1, ['String'] set P1, "ok 1\n" set P10["x"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 2\n" set P10["a"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 3\n" set P10["j"], P1 @@ -189,8 +189,8 @@ OUT pasm_output_is( <<'CODE', <<OUT, "exists_keyed" ); - new P0, 'OrderedHash' - new P1, 'Integer' + new P0, ['OrderedHash'] + new P1, ['Integer'] set P0["key"], P1 exists I0, P0["key"] print I0 @@ -200,7 +200,7 @@ print I0 exists I0, P0[1] print I0 - new P1, 'Key' + new P1, ['Key'] set P1, 0 exists I0, P0[P1] print I0 @@ -214,8 +214,8 @@ OUT pasm_output_is( <<'CODE', <<OUT, "defined_keyed" ); - new P0, 'OrderedHash' - new P1, 'Undef' + new P0, ['OrderedHash'] + new P1, ['Undef'] set P0["key"], P1 defined I0, P0["key"] print I0 @@ -225,7 +225,7 @@ print I0 defined I0, P0[1] print I0 - new P2, 'Key' + new P2, ['Key'] set P2, 0 defined I0, P0[P2] print I0 @@ -238,7 +238,7 @@ print I0 defined I0, P0[0] print I0 - new P3, 'Key' + new P3, ['Key'] set P3, 0 defined I0, P0[P3] print I0 @@ -253,20 +253,20 @@ pasm_output_is( <<'CODE', <<OUT, "delete" ); .include "iterator.pasm" - new P0, 'OrderedHash' - new P1, 'String' + new P0, ['OrderedHash'] + new P1, ['String'] set P1, "ok 1\n" set P0["x"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 2\n" set P0["a"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 3\n" set P0["j"], P1 delete P0["a"] - new P2, 'Iterator', P0 + new P2, ['Iterator'], P0 set P2, .ITERATE_FROM_START_KEYS iter_loop: unless P2, end_iter @@ -295,11 +295,11 @@ OUT pasm_output_is( <<'CODE', <<'OUTPUT', "delete with int keys" ); - new P0, 'OrderedHash' + new P0, ['OrderedHash'] set P0["abc"], "Foo" set P0["def"], 12.6 set P0["ghi"], 5 - new P1, 'Key' + new P1, ['Key'] set P1, 1 delete P0[P1] exists I0, P0["abc"] @@ -322,18 +322,18 @@ pasm_output_like( <<'CODE', '/[axj]/', "iterate over keys" ); .include "iterator.pasm" - new P0, 'OrderedHash' - new P1, 'String' + new P0, ['OrderedHash'] + new P1, ['String'] set P1, "ok 1\n" set P0["x"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 2\n" set P0["a"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 3\n" set P0["j"], P1 - new P2, 'Iterator', P0 + new P2, ['Iterator'], P0 set P2, .ITERATE_FROM_START_KEYS iter_loop: unless P2, end_iter @@ -346,18 +346,18 @@ pasm_output_like( <<'CODE', <<'OUT', "iterate over keys, get value" ); .include "iterator.pasm" - new P0, 'OrderedHash' - new P1, 'String' + new P0, ['OrderedHash'] + new P1, ['String'] set P1, "ok 1\n" set P0["x"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 2\n" set P0["a"], P1 - new P1, 'String' + new P1, ['String'] set P1, "ok 3\n" set P0["j"], P1 - new P2, 'Iterator', P0 + new P2, ['Iterator'], P0 set P2, .ITERATE_FROM_START_KEYS iter_loop: unless P2, end_iter @@ -377,9 +377,9 @@ .sub _main .local pmc hash1 - hash1 = new 'OrderedHash' + hash1 = new ['OrderedHash'] .local pmc val_in - val_in = new 'String' + val_in = new ['String'] val_in = "U" hash1["X"] = val_in @@ -398,7 +398,7 @@ .sub _main .local pmc hash1 - hash1 = new 'OrderedHash' + hash1 = new ['OrderedHash'] hash1["X"] = 14 .local pmc val_out @@ -416,7 +416,7 @@ .sub _main .local pmc hash1 - hash1 = new 'OrderedHash' + hash1 = new ['OrderedHash'] .local string val1 val1 = 'U' set hash1["X"], val1 @@ -436,7 +436,7 @@ .sub _main .local pmc hash1 - hash1 = new 'OrderedHash' + hash1 = new ['OrderedHash'] hash1["X"] = '14' .local pmc val_out @@ -455,7 +455,7 @@ .sub _main .local pmc hash1 - hash1 = new 'OrderedHash' + hash1 = new ['OrderedHash'] .local string key1 key1 = 'X' @@ -476,7 +476,7 @@ .sub _main .local pmc hash1 - hash1 = new 'OrderedHash' + hash1 = new ['OrderedHash'] .local string key1 key1 = 'X' @@ -497,7 +497,7 @@ .sub _main .local pmc hash1 - hash1 = new 'OrderedHash' + hash1 = new ['OrderedHash'] .local int hash_size hash_size = hash1 @@ -529,11 +529,11 @@ OUTPUT pasm_output_is( <<'CODE', <<'OUTPUT', "delete and access remaining" ); - new P0, 'OrderedHash' - new P1, 'String' + new P0, ['OrderedHash'] + new P1, ['String'] set P1, "A" set P0["a"], P1 - new P1, 'String' + new P1, ['String'] set P1, "B" set P0["b"], P1 @@ -557,7 +557,7 @@ .sub _main .local pmc pmc1 - pmc1 = new 'OrderedHash' + pmc1 = new ['OrderedHash'] .local int bool1 does bool1, pmc1, "scalar" print bool1 @@ -581,7 +581,7 @@ OUTPUT pasm_output_is( <<'CODE', <<'OUTPUT', "get_integer_keyed" ); - new P0, 'OrderedHash' + new P0, ['OrderedHash'] set P0["Foo"], 10 set P0["Bar"], 20 set I0, P0["Bar"] @@ -605,7 +605,7 @@ OUTPUT pasm_output_is( <<'CODE', <<'OUTPUT', "get_number_keyed" ); - new P0, 'OrderedHash' + new P0, ['OrderedHash'] set N0, 12.3 set N1, 45.1 set P0["Foo"], N0 @@ -635,9 +635,9 @@ OUTPUT pasm_output_is( <<'CODE', <<'OUTPUT', "set/get compound key" ); - new P0, 'OrderedHash' + new P0, ['OrderedHash'] set P0["a"], "Foo\n" - new P1, 'Hash' + new P1, ['Hash'] set P1['foo'], "bar\n" set P0["b"], P1 set P2, P0['b'; 'foo'] @@ -661,9 +661,9 @@ OUTPUT pasm_output_is( <<'CODE', <<'OUTPUT', "exists compound key" ); - new P0, 'OrderedHash' + new P0, ['OrderedHash'] set P0["a"], "Foo" - new P1, 'Hash' + new P1, ['Hash'] set P1['foo'], "bar\n" set P0["b"], P1 set P0['b'; 'quux'], "xyzzy\n" @@ -697,9 +697,9 @@ OUTPUT pasm_output_is( <<'CODE', <<'OUTPUT', "delete compound key" ); - new P0, 'OrderedHash' + new P0, ['OrderedHash'] set P0["a"], "Foo" - new P1, 'Hash' + new P1, ['Hash'] set P1['foo'], "bar\n" set P0["b"], P1 set P0['b'; 'quux'], "xyzzy\n" @@ -742,7 +742,7 @@ OUTPUT pasm_output_is( <<'CODE', <<'OUTPUT', "freeze/thaw 1" ); - new P0, 'OrderedHash' + new P0, ['OrderedHash'] set P0["a"], "Foo\n" set P0["b"], "Bar\n" @@ -766,9 +766,9 @@ OUTPUT pasm_output_is( <<'CODE', <<'OUTPUT', "freeze/thaw 2" ); - new P0, 'OrderedHash' + new P0, ['OrderedHash'] set P0["a"], "Foo\n" - new P1, 'Hash' + new P1, ['Hash'] set P1['foo'], "bar\n" set P0["b"], P1 set P0['b'; 'quux'], "xyzzy\n" @@ -837,11 +837,11 @@ .sub get_frozen_hash .local pmc parent - parent = new 'OrderedHash' + parent = new ['OrderedHash'] parent['a'] = 'Foo' .local pmc child - child = new 'OrderedHash' + child = new ['OrderedHash'] child['foo'] = 'bar' push child, 'baz'