File: systemfuncs2code.py

package info (click to toggle)
openmsx 0.8.2-2.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 15,796 kB
  • sloc: cpp: 124,615; xml: 22,614; tcl: 7,336; python: 3,789; asm: 1,154; sh: 69; makefile: 25
file content (33 lines) | stat: -rw-r--r-- 876 bytes parent folder | download | duplicates (2)
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
33
# $Id: systemfuncs2code.py 10755 2009-11-07 03:19:33Z mthuurne $

from systemfuncs import systemFunctions
from outpututils import rewriteIfChanged

import sys

def iterSystemFuncsHeader(functionResults):
	yield '// Automatically generated by build system.'
	for makeName in sorted(
		func.getMakeName() for func in systemFunctions
		):
		yield '#define HAVE_%s %d' % (makeName, functionResults[makeName])

def getSystemFuncsInfo():
	return dict.fromkeys(
		(func.getMakeName() for func in systemFunctions),
		False
		)

if __name__ == '__main__':
	if len(sys.argv) == 2:
		rewriteIfChanged(
			sys.argv[1],
			iterSystemFuncsHeader(getSystemFuncsInfo())
			)
	else:
		print >> sys.stderr, \
			'Usage: python systemfuncs2code.py CONFIG_HEADER '
		print >> sys.stderr, \
			'Note: Should only be called directly on systems where the probe ' \
			'does not work.'
		sys.exit(2)