File: convert_itp.py

package info (click to toggle)
intel-gpu-tools 2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 62,024 kB
  • sloc: xml: 769,439; ansic: 348,692; python: 8,307; yacc: 2,781; perl: 1,196; sh: 1,178; lex: 487; asm: 227; makefile: 27; lisp: 11
file content (17 lines) | stat: -rwxr-xr-x 540 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python3

#this script helps to convert internal debugger scripts given to us into our tools

import sys
import fileinput

def replace_with_dict(text, dicto):
	for key, val in dicto.items():
		text = text.replace(key, val)
	return text

for lines in fileinput.input([sys.argv[1]], inplace=True):
	lines = lines.strip()
	if lines == '': continue # strip empty lines
	replace_dict = {'dword(' : '../tools/intel_reg_read ', 'MMADDR + ' : '', '//' : '#', ')p;' : '', ')p ' : ' -c '}
	print(replace_with_dict(lines, replace_dict))