On Saturday 10 June 2006 01:44, Leopold Toetsch wrote: > Patch missing?
That would explain the segfault. No seriously, here it is. -- c
=== lib/PhemeSymbols.pir ================================================================== --- lib/PhemeSymbols.pir (revision 17677) +++ lib/PhemeSymbols.pir (local) @@ -14,72 +14,9 @@ .return() .end -.namespace [ 'Pheme::Cons' ] - -.sub _initialize :load - .local pmc cons_class - newclass cons_class, 'Pheme::Cons' - - addattribute cons_class, 'head' - addattribute cons_class, 'tail' -.end - -.sub 'head' :method - .param pmc new_head :optional - .param int have_head :opt_flag - - unless have_head goto return_head - setattribute self, 'head', new_head - .return( new_head ) - - return_head: - .local pmc head - head = getattribute self, 'head' - .return( head ) -.end - -.sub __get_integer :method - .local pmc elem - elem = self.'head'() - - .local int elem_defined - elem_defined = defined elem - - if elem_defined goto count_tail - .return( 0 ) - - count_tail: - .local int count - count = 0 - elem = self - - loop_start: - inc count - elem = elem.'tail'() - elem_defined = defined elem - if elem_defined goto loop_start - - loop_end: - .return( count ) -.end - -.sub 'tail' :method - .param pmc new_tail :optional - .param int have_tail :opt_flag - - unless have_tail goto return_tail - setattribute self, 'tail', new_tail - .return( new_tail ) - - return_tail: - .local pmc tail - tail = getattribute self, 'tail' - .return( tail ) -.end - .namespace [ 'Pheme' ] -.sub __resolve_at_runtime :multi( Pheme::Cons ) +.sub __resolve_at_runtime :multi( [ 'Pheme'; 'Cons' ] ) .param pmc args :slurpy .local pmc result @@ -112,7 +49,7 @@ .param pmc args :slurpy .local int cons_type - cons_type = find_type 'Pheme::Cons' + cons_type = find_type [ 'Pheme'; 'Cons' ] .local pmc result result = new cons_type @@ -171,7 +108,7 @@ .param pmc r .local int cons_type - cons_type = find_type 'Pheme::Cons' + cons_type = find_type [ 'Pheme'; 'Cons' ] .local pmc result result = new cons_type @@ -253,7 +190,7 @@ .return( 1 ) .end -.sub 'eq?' :multi( Pheme::Cons, Pheme::Cons ) +.sub 'eq?' :multi( [ 'Pheme'; 'Cons' ], [ 'Pheme'; 'Cons' ] ) .param pmc l_cons .param pmc r_cons @@ -273,7 +210,7 @@ .local pmc result .local int cons_type - cons_type = find_type 'Pheme::Cons' + cons_type = find_type [ 'Pheme'; 'Cons' ] .local pmc result result = new cons_type === lib/PhemeTest.pir ================================================================== --- lib/PhemeTest.pir (revision 17677) +++ lib/PhemeTest.pir (local) @@ -1,6 +1,6 @@ .namespace[ 'Test::More' ] -.sub is :multi( Pheme::Cons, Pheme::Cons ) +.sub is :multi( [ 'Pheme'; 'Cons' ], [ 'Pheme'; 'Cons' ] ) .param pmc l_cons .param pmc r_cons .param string description :optional @@ -18,7 +18,7 @@ .return( equal ) .end -.sub is_deeply :multi( Pheme::Cons, Pheme::Cons ) +.sub is_deeply :multi( [ 'Pheme'; 'Cons' ], [ 'Pheme'; 'Cons' ] ) .param pmc l_cons .param pmc r_cons .param string description :optional === pheme.pir ================================================================== --- pheme.pir (revision 17677) +++ pheme.pir (local) @@ -6,6 +6,7 @@ errorson .PARROT_ERRORS_PARAM_COUNT_FLAG load_bytecode 'languages/pheme/lib/PhemeCompiler.pbc' + load_bytecode 'languages/pheme/lib/PhemeObjects.pir' load_bytecode 'languages/pheme/lib/PhemeSymbols.pbc' load_bytecode 'languages/pheme/lib/pheme_grammar_gen.pir' --- /dev/null 2006-01-19 12:13:44.000000000 -0800 +++ lib/PhemeObjects.pir 2006-06-01 23:14:25.000000000 -0700 @@ -0,0 +1,62 @@ +.namespace [ 'Pheme'; 'Cons' ] + +.sub _initialize :anon :load + .local pmc cons_class + newclass cons_class, [ 'Pheme'; 'Cons' ] + + addattribute cons_class, 'head' + addattribute cons_class, 'tail' +.end + +.sub 'head' :method + .param pmc new_head :optional + .param int have_head :opt_flag + + unless have_head goto return_head + setattribute self, 'head', new_head + .return( new_head ) + + return_head: + .local pmc head + head = getattribute self, 'head' + .return( head ) +.end + +.sub __get_integer :method + .local pmc elem + elem = self.'head'() + + .local int elem_defined + elem_defined = defined elem + + if elem_defined goto count_tail + .return( 0 ) + + count_tail: + .local int count + count = 0 + elem = self + + loop_start: + inc count + elem = elem.'tail'() + elem_defined = defined elem + if elem_defined goto loop_start + + loop_end: + .return( count ) +.end + +.sub 'tail' :method + .param pmc new_tail :optional + .param int have_tail :opt_flag + + unless have_tail goto return_tail + setattribute self, 'tail', new_tail + .return( new_tail ) + + return_tail: + .local pmc tail + tail = getattribute self, 'tail' + .return( tail ) +.end