File: mapoffset.awk

package info (click to toggle)
fis-gtm 6.2-000-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 30,784 kB
  • ctags: 42,554
  • sloc: ansic: 358,483; asm: 4,847; csh: 4,574; sh: 2,261; awk: 200; makefile: 86; sed: 13
file content (32 lines) | stat: -rw-r--r-- 1,161 bytes parent folder | download
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
31
32
BEGIN	{
		dontprint = 0; insrclist = 1; cursrcline = 1; listline = 0;
	}
$1 == ""						{ dontprint = 1; }
$1 == ""						{ dontprint = 1; }
$1 == "Routine" && $2 == "Size:"			{ dontprint = 1; }
$1 == "Source" && $2 == "Listing"			{ dontprint = 3; }
$1 == "Machine" && $2 == "Code" && $3 == "Listing"	{ dontprint = 3; }
$1 == ".PSECT" && $2 == "$LINK$,"			{ exit; }
$1 == ".PSECT"  					{ insrclist = 0; next; }
dontprint						{ dontprint--; next; }
insrclist	{
			sub("^[ 0-9][ 0-9][ 0-9][ 0-9][ 0-9][ 0-9][ 0-9][X\t]","",$0);
			if (srcline[$1] == "")
				srcline[$1] = cursrcline++;
			next;
		}
!insrclist	{
			sub("^\t","        ",$0);	# replace tabs with spaces at the beginning
			offset = substr($0, 10, 8);
			gsub(" ", "0", offset);
			lastbutone = NF - 1;
			# do not consider usages like "; R28" as a listing line number
			if (($lastbutone == ";") && (substr($NF, 1, 1) != "R"))
			{
				listline = +$NF;	# the "+" is to typecast $NF into a number (instead of a string)
				printf "\tset ^offset(\"%s\",\"%s\",0)=%d\n", module, offset, srcline[listline];
				printf "\tset ^offset(\"%s\",\"%s\",1)=%d\n", module, offset, listline;
			}
		}
END	{
	}