summaryrefslogtreecommitdiff
path: root/regression_tests/assembler/process_in_file
blob: 6c2c0b506312dbd14a62902812ec3e12bef99081 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /bin/bash

# --------------------------------------------------------------------------
# Auxiliary script for regression testing environment
#
# This script transforms .in files for assembler regression testing into a list
# of command line switches, which are then passed to the assembler. This
# process is done in this way, all comments and empty lines are removed and the
# rest in then concatenated to from a single line. After this all white space
# is shortened.
#
# Software requirements:
# 	- gawk
# --------------------------------------------------------------------------

gawk '
	BEGIN {
		ORS=" "
	}

	{
		sub(/#.*$/, "", $0)
		print($0)
	}
' "${1}" | gawk '
	{
		gsub(/[[:space:]]+/, " ", $0)
		printf("%s", $0)
	}
'