In an effort to get APL working, I first have to be able to read an
APL program into memory, which means unicode operators.
As I'm modifying ponie, I end up with something like:
.sub _slurp_file
.param string filename
.local pmc filehandle
filehandle = open filename, "<"
push filehandle, 'utf8'
unless filehandle goto err_no_file
$S1 = read filehandle, 65535
close filehandle
$I99 = charset $S1
$S99 = charsetname $I99
print "source is "
print $S1
print "\n"
print "charset of source is: "
print $S99
print "\n"
.return ($S1)
.end
This compiles, prints out what looks like the right source code
(which at the moment is neither punie nor APL: "print 2²10;")
But the charset that's listed is ascii. I need to be able to read in
the utf8 encoded file and have it recognized as such by parrot.
It would also be helpful to have badly-specified IO filters generate
an exception. (utf8 doesn't appear to since it's supported for
*output*. using "monkeys" as the filter generates the slightly more
helpful: 'Layer not found').
I hate unicode. That is 'print 2 <LESS-THAN OR EQUAL TO> 10;'