This patch gives the assembler support of '\a','\n','\r','\t', and '\\' in string constants. In addition, it changes (for all registers) "I reg %li is ..." to just the value of the register. Printing constants is also supported, but alas, you have to specify the type (print_sc, print_ic, print_nc). Brian
? pasm.pl ? patch ? test2.pbc ? test3.pbc ? euclid0.pbc ? euclid1.pbc ? euclid.pbc ? print_cleanups.diff ? bitops.pbc ? bitops+assembler.patch ? t/bitops.pasm Index: assemble.pl =================================================================== RCS file: /home/perlcvs/parrot/assemble.pl,v retrieving revision 1.12 diff -r1.12 assemble.pl 112c112 < if($op=~/$test/) { --- > if($op=~/^$test$/) { 121,122c121 < error("Wrong arg count--got ".scalar(@args)." needed < ".$opcodes{$opcode}{ARGS}); --- > error("Wrong arg count--got ".scalar(@args)." needed >".$opcodes{$opcode}{ARGS}); 131,132c130 < if($rtype eq "I" || $rtype eq "N" || $rtype eq "P" || $rtype eq < "S") { --- > if($rtype eq "I" || $rtype eq "N" || $rtype eq "P" || $rtype eq "S") { 219a218,220 > # handle \ characters in the constant > my %escape = ('a'=>"\a",'n'=>"\n",'r'=>"\r",'t'=>"\t",'\\'=>'\\',); > $s=~s/\\([anrt\\])/$escape{$1}/g; 223a225 > Index: basic_opcodes.ops =================================================================== RCS file: /home/perlcvs/parrot/basic_opcodes.ops,v retrieving revision 1.13 diff -r1.13 basic_opcodes.ops 120c120 < printf("I reg %li is %li\n", P1, INT_REG(P1)); --- > printf("%li", INT_REG(P1)); 121a122,127 > > /* PRINT ic */ > AUTO_OP print_ic { > printf("%li", P1); > } > 212c218 < printf("N reg %li is %f\n", P1, NUM_REG(P1)); --- > printf("%f", NUM_REG(P1)); 214a221,225 > /* PRINT nc */ > AUTO_OP print_nc { > printf("%f", P1); > } > 317c328,334 < printf("S reg %li is %.*s\n", P1, (int) string_length(s), (char *) s->bufstart); --- > printf("%.*s",(int)string_length(s),(char *) s->bufstart); > } > > /* PRINT sc */ > AUTO_OP print_sc { > STRING *s = Parrot_string_constants[P1]; > printf("%.*s",(int)string_length(s),(char *) s->bufstart); 318a336 > Index: opcode_table =================================================================== RCS file: /home/perlcvs/parrot/opcode_table,v retrieving revision 1.12 diff -r1.12 opcode_table 56a57 > print_sc 1 s 86a88 > print_ic 1 i 88a91 > print_nc 1 n