70be662001-06-19Fredrik Hübinette (Hubbe) #!/bin/sh
86b3c02003-08-15Henrik Grubbström (Grubba) sed -e ' # First convert #line directives. s/^# \([0-9]* "[^"]*"\).*$/#line \1/ s/^# \([0-9]*\).*$/#line \1/ t # Output all complete OPCODE[0-9].* --- expressions # accumulated so far.
99a2af2003-08-15Henrik Grubbström (Grubba) : loop
86b3c02003-08-15Henrik Grubbström (Grubba)  /OPCODE[0-9]/!b keepnl # Stupid IRIX cpp turns --- into -- - # SysV sed does not support multi-character *-expressions, # so we use % instead. s/ -- \{0,1\}- / ½ /g # Make sure the substitute flag is cleared. t loop h s/^[^½]*\(OPCODE[0-9][^½]*\) ½.*$/\1¤/p t more N b loop # Remove the match from the hold space, # and check for more.
cb398d2003-08-14Henrik Grubbström (Grubba) : more
86b3c02003-08-15Henrik Grubbström (Grubba)  g s/^[^½]*OPCODE[0-9][^½]* ½\(.*\)$/\1/ b loop # Keep only the newlines.
cb398d2003-08-14Henrik Grubbström (Grubba) : keepnl
86b3c02003-08-15Henrik Grubbström (Grubba)  s/.//g' | sed -e ' # Remove newlines that were inserted by p. : loop /¤$/{ N s/¤\n// b loop } # Put empty lines in hold, and start the next cycle. /^[ ]*$/{ H d } # Clear hold, and put #line directives there, # and start the next cycle. /^#line/{ h d } # Print hold except for a possible initial newline. x s/^\ // p # Clear hold. s/.//g x'