Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
#!/afs/net/tools/@sys/perl
#
#

$in_block_comment = 0;

while (<>) {
	if (/^\|/) {
		if (! $in_block_comment) {
			print "/* \n";
			$in_block_comment = 1;
		}
		s/\|/ */;
		print;
		next;
	} else {
		if ($in_block_comment) {
			print " */\n";
			$in_block_comment = 0;
		}
	}
			
	s/#/$/;		# Convert immediate references
	s/\|/#/;	# Convert in-line comments

	s/(\b|,)([abcd][xhl])(\b|,|$)/\1%\2\3/g;
	s/(\b|,)([cdsefg]s)(\b|,|$)/\1%\2\3/g;
	s/(\b|,)([sd]i)(\b|,|$)/\1%\2\3/g;
	s/(\b|,)([sb]p)(\b|,|$)/\1%\2\3/g;
	s/(\b|,)(e[abcd]x)(\b|,|$)/\1%\2\3/g;

	if (/^(([a-zA-Z]+:[ \t]+)|[ \t]+)([a-zA-Z]+)/) {
		$op = $3;
		if (($op eq "mov") || ($op eq "add") || ($op eq "sub") ||
		    ($op eq "xor") || ($op eq "and") || ($op eq "shr") ||
		    ($op eq "shl") || ($op eq "in")  || ($op eq "out")) {
			#
			# We need to swap arguments...
			#
			s/([0-9a-zA-Z%\$]+)(,)([0-9a-zA-Z%\$]+)/\3\2\1/;
		}
	}
	
	print;
}