/* * DO NOT EDIT - THIS FILE IS AUTOGENERATED - CHANGES WILL BE LOST * Written by ./bin/text2macro.pl from plperl6.pir */ #define PLPERL6 \ "# PL/Parrot is copyright Jonathan \"Duke\" Leto and friends 2009-2010\n" \ "# This code is released under the Artistic 2.0 License, see LICENSE for details.\n" \ "\n" \ ".sub run\n" \ " .param string code\n" \ " .param pmc args :slurpy\n" \ " .local pmc perl6_args\n" \ "\n" \ " perl6_args = convert_to_perl6_parcel(args)\n" \ " .local string wrap_start, wrap_end\n" \ " wrap_start = \"eval q<<< sub \"\n" \ " wrap_end = \" >>>\"\n" \ " code = wrap_start . code\n" \ " code .= wrap_end\n" \ " load_bytecode 'dumper.pbc'\n" \ " print \"About to run: \"\n" \ " say code\n" \ "\n" \ " .local pmc compiler, function, output\n" \ " compiler = compreg \"perl6\"\n" \ " function = compiler.'compile'(code)\n" \ " say \"args=\"\n" \ " _dumper(perl6_args)\n" \ " output = function()\n" \ " .local int nullargs\n" \ " nullargs = isnull perl6_args\n" \ " if nullargs goto call_with_empty_args\n" \ " say \"calling with args\"\n" \ " $P3 = output(perl6_args :flat)\n" \ " $I0 = isa $P3, \"Block\"\n" \ " unless $I0 goto done\n" \ " # the output of running the function returned a Block,\n" \ " # such as a pointy block -> $a, $b { }, so let's go ahead\n" \ " # and execute that\n" \ " $P3 = $P3(perl6_args)\n" \ " goto done\n" \ " call_with_empty_args:\n" \ " say \"calling with null args\"\n" \ " $P3 = output()\n" \ "\n" \ " done:\n" \ " print \"code returned: \"\n" \ " _dumper($P3)\n" \ " say \"==============\"\n" \ " .return($P3)\n" \ ".end\n" \ "\n" \ ".sub convert_to_perl6_parcel\n" \ " .param pmc parrot_array\n" \ " .local pmc arrayizer, perl6_parcel\n" \ "\n" \ " unless parrot_array goto empty\n" \ "\n" \ " # the infix comma operator, which creates Parcels from scalars\n" \ " arrayizer = get_root_global ['perl6'], '&infix:<,>'\n" \ " unless arrayizer goto error\n" \ "\n" \ " # pass a flattened array to the comma operator\n" \ " perl6_parcel = arrayizer(parrot_array :flat)\n" \ " .return(perl6_parcel)\n" \ " error:\n" \ " die \"Could not turn Parrot array into a Perl 6 Parcel!\"\n" \ " empty:\n" \ " .return()\n" \ ".end\n" \ "" /* end */