summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/build
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build')
-rwxr-xr-xscripts/build/check_include_guards.py51
-rwxr-xr-xscripts/build/complay.py22
-rw-r--r--scripts/build/verinfo.py4
3 files changed, 69 insertions, 8 deletions
diff --git a/scripts/build/check_include_guards.py b/scripts/build/check_include_guards.py
new file mode 100755
index 00000000000..bcc1bd889e9
--- /dev/null
+++ b/scripts/build/check_include_guards.py
@@ -0,0 +1,51 @@
+#!/usr/bin/python3
+##
+## icense:BSD-3-Clause
+## copyright-holders:Vas Crabb
+
+import io
+import os
+import os.path
+import re
+import sys
+
+
+def pathsplit(p):
+ result = [ ]
+ while p:
+ d, n = os.path.split(p)
+ if not n:
+ result.insert(0, d)
+ break
+ else:
+ result.insert(0, n)
+ p = d
+ return result
+
+
+if __name__ == '__main__':
+ extpat = re.compile('.+\\.(h|hpp)$')
+ substpat = re.compile('[-.]')
+ guardpat = re.compile('^ *# *ifndef +([^\s]+)(\s+.*)?')
+ bad = False
+ if len(sys.argv) < 2:
+ sys.stderr.write("Error: requires at least one path defined\n")
+ sys.exit(2)
+
+ for root in sys.argv[1:]:
+ for path, subdirs, files in os.walk(root):
+ prefix = 'MAME_' + '_'.join([n.upper() for n in pathsplit(os.path.relpath(path, root))]) + '_'
+ for f in files:
+ if extpat.match(f):
+ expected = prefix + substpat.sub('_', f.upper())
+ fp = os.path.join(path, f)
+ with io.open(fp, 'r', encoding='utf-8') as fd:
+ for l in fd:
+ m = guardpat.match(l)
+ if m:
+ if m.group(1) != expected:
+ sys.stderr.write('%s: #include guard does not appear to match expected %s\n' % (fp, expected))
+ bad = True
+ break
+ if bad:
+ sys.exit(1)
diff --git a/scripts/build/complay.py b/scripts/build/complay.py
index 475806c0e65..6519a01de06 100755
--- a/scripts/build/complay.py
+++ b/scripts/build/complay.py
@@ -174,6 +174,17 @@ class LayoutChecker(Minifyer):
self.handle_error('Element %s attribute %s "%s" is not a number' % (name, key, val))
return None
+ def check_bool_attribute(self, name, attrs, key, default):
+ if key not in attrs:
+ return default
+ val = attrs[key]
+ if self.VARPATTERN.match(val):
+ return None
+ elif val in self.YESNO:
+ return 'yes' == val
+ self.handle_error('Element %s attribute %s "%s" is not "yes" or "no"' % (name, key, val))
+ return None
+
def check_parameter(self, attrs):
if 'name' not in attrs:
self.handle_error('Element param missing attribute name')
@@ -253,8 +264,7 @@ class LayoutChecker(Minifyer):
if self.check_int_attribute('orientation', attrs, 'rotate', 0) not in self.ORIENTATIONS:
self.handle_error('Element orientation attribute rotate "%s" is unsupported' % (attrs['rotate'], ))
for name in ('swapxy', 'flipx', 'flipy'):
- if (attrs.get(name, 'no') not in self.YESNO) and (not self.VARPATTERN.match(attrs[name])):
- self.handle_error('Element orientation attribute %s "%s" is not "yes" or "no"' % (name, attrs[name]))
+ self.check_bool_attribute('orientation', attrs, name, None)
def check_color(self, attrs):
self.check_color_channel(attrs, 'red')
@@ -324,8 +334,8 @@ class LayoutChecker(Minifyer):
self.handle_error('Element %s has inputraw attribute without inputtag attribute' % (name, ))
inputmask = self.check_int_attribute(name, attrs, 'inputmask', None)
if (inputmask is not None) and (not inputmask):
- if (inputraw is None) or (not inputraw):
- self.handle_error('Element %s attribute inputmask "%s" is zero' % (name, attrs['inputmask']))
+ self.handle_error('Element %s attribute inputmask "%s" is zero' % (name, attrs['inputmask']))
+ self.check_bool_attribute(name, attrs, 'clickthrough', None)
def startViewItem(self, name):
self.handlers.append((self.viewItemStartHandler, self.viewItemEndHandler))
@@ -399,6 +409,7 @@ class LayoutChecker(Minifyer):
self.views[attrs['name']] = self.format_location()
elif not self.VARPATTERN.match(attrs['name']):
self.handle_error('Element view has duplicate name "%s" (previous %s)' % (attrs['name'], self.views[attrs['name']]))
+ self.check_bool_attribute(name, attrs, 'showpointers', None)
self.handlers.append((self.groupViewStartHandler, self.groupViewEndHandler))
self.variable_scopes.append({ })
self.item_ids = { }
@@ -676,8 +687,7 @@ class LayoutChecker(Minifyer):
else:
have_scroll[-1] = self.format_location()
self.check_float_attribute(name, attrs, 'size', 1.0)
- if (attrs.get('wrap', 'no') not in self.YESNO) and (not self.VARPATTERN.match(attrs['wrap'])):
- self.handle_error('Element %s attribute wrap "%s" is not "yes" or "no"' % (name, attrs['wrap']))
+ self.check_bool_attribute(name, attrs, 'wrap', False)
if 'inputtag' in attrs:
if 'name' in attrs:
self.handle_error('Element %s has both attribute inputtag and attribute name' % (name, ))
diff --git a/scripts/build/verinfo.py b/scripts/build/verinfo.py
index 4b05d860406..68038b6251b 100644
--- a/scripts/build/verinfo.py
+++ b/scripts/build/verinfo.py
@@ -23,7 +23,7 @@ def parse_args():
def extract_version(verinfo):
- pattern = re.compile('\s+BARE_BUILD_VERSION\s+"(([^."]+)\.([^."]+))"')
+ pattern = re.compile(r'\s+BARE_BUILD_VERSION\s+"(([^."]+)\.([^."]+))"')
for line in verinfo:
match = pattern.search(line)
if match:
@@ -122,7 +122,7 @@ if __name__ == '__main__':
original=options.executable,
product=('MAME' if options.target == 'mame' else options.target),
rdns=('org.mamedev.' + internal),
- copyright='\u00a9 1997-2023 MAMEdev and contributors',
+ copyright='\u00a9 1997-2025 MAMEdev and contributors',
winfileflags=('0x0L' if verbuild == '0' else 'VS_FF_PRERELEASE'),
resources=(options.resources or 'mame.rc'))