From b2158bd6ed6d7bb1ed0e7cf665b04f56ecbe3403 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 9 Sep 2020 21:29:45 +1000 Subject: -Eliminate remaining elements from internal layouts. These layouts have changes to element stacking order that can't be avoided without changing the group structure in the layout files. I think it's harmless, but it's possible it could have had a detrimental effect on risc2500 (I tested it and didn't see any changes, but I might not have known what to look for). -complay.py: Added basic checks for dupicate collection names. As with other checks of this kind, it doesn't actually instantiate the layout so it doesn't check things when variable substitution is involved. --- scripts/build/complay.py | 31 ++- src/mame/layout/mephisto_alm16.lay | 436 ++++++++++++++++---------------- src/mame/layout/mephisto_alm32.lay | 436 ++++++++++++++++---------------- src/mame/layout/mephisto_gen32.lay | 436 ++++++++++++++++---------------- src/mame/layout/mephisto_polgar.lay | 412 +++++++++++++++--------------- src/mame/layout/saitek_intchess.lay | 80 +++--- src/mame/layout/saitek_risc2500.lay | 489 ++++++++++++++++++------------------ 7 files changed, 1171 insertions(+), 1149 deletions(-) diff --git a/scripts/build/complay.py b/scripts/build/complay.py index 5dfee05e018..9b3334d96c2 100755 --- a/scripts/build/complay.py +++ b/scripts/build/complay.py @@ -97,7 +97,7 @@ class LayoutChecker(Minifyer): VARPATTERN = re.compile('^.*~[0-9A-Za-z_]+~.*$') FLOATCHARS = re.compile('^.*[.eE].*$') SHAPES = frozenset(('disk', 'dotmatrix', 'dotmatrix5dot', 'dotmatrixdot', 'led14seg', 'led14segsc', 'led16seg', 'led16segsc', 'led7seg', 'led8seg_gts1', 'rect')) - OBJECTS = frozenset(('backdrop', 'bezel')) + OBJECTS = frozenset(('backdrop', )) ORIENTATIONS = frozenset((0, 90, 180, 270)) YESNO = frozenset(('yes', 'no')) BLENDMODES = frozenset(('none', 'alpha', 'multiply', 'add')) @@ -111,6 +111,8 @@ class LayoutChecker(Minifyer): self.views = { } self.referenced_elements = { } self.referenced_groups = { } + self.group_collections = { } + self.current_collections = None def formatLocation(self): return '%s:%d:%d' % (self.locator.getSystemId(), self.locator.getLineNumber(), self.locator.getColumnNumber()) @@ -320,6 +322,7 @@ class LayoutChecker(Minifyer): self.handleError('Element element attribute defstate "%s" is negative' % (attrs['defstate'], )) self.handlers.append((self.elementStartHandler, self.elementEndHandler)) elif 'group' == name: + self.current_collections = { } if 'name' not in attrs: self.handleError('Element group missing attribute name') else: @@ -328,6 +331,8 @@ class LayoutChecker(Minifyer): self.generated_group_names = True if attrs['name'] not in self.groups: self.groups[attrs['name']] = self.formatLocation() + if not generated_name: + self.group_collections[attrs['name']] = self.current_collections elif not generated_name: self.handleError('Element group has duplicate name (previous %s)' % (self.groups[attrs['name']], )) self.handlers.append((self.groupViewStartHandler, self.groupViewEndHandler)) @@ -335,6 +340,7 @@ class LayoutChecker(Minifyer): self.repeat_depth.append(0) self.have_bounds.append(False) elif ('view' == name) and (not self.repeat_depth[-1]): + self.current_collections = { } if 'name' not in attrs: self.handleError('Element view missing attribute name') else: @@ -475,7 +481,7 @@ class LayoutChecker(Minifyer): if ('element' != name) and not self.has_legacy_object: self.has_legacy_object = True if self.has_collection: - self.handleError('Layout contains collection as well as legacy backdrop/bezel elements') + self.handleError('Layout contains collection as well as legacy backdrop elements') self.handlers.append((self.objectStartHandler, self.objectEndHandler)) self.have_bounds.append(False) self.have_orientation.append(False) @@ -497,8 +503,15 @@ class LayoutChecker(Minifyer): elif 'group' == name: if 'ref' not in attrs: self.handleError('Element group missing attribute ref') - elif attrs['ref'] not in self.referenced_groups: - self.referenced_groups[attrs['ref']] = self.formatLocation() + else: + if attrs['ref'] not in self.referenced_groups: + self.referenced_groups[attrs['ref']] = self.formatLocation() + if (not self.VARPATTERN.match(attrs['ref'])) and (attrs['ref'] in self.group_collections): + for n, l in self.group_collections[attrs['ref']].items(): + if n not in self.current_collections: + self.current_collections[n] = l + else: + self.handleError('Element group instantiates collection with duplicate name "%s" from %s (previous %s)' % (n, l, self.current_collections[n])) self.handlers.append((self.objectStartHandler, self.objectEndHandler)) self.have_bounds.append(False) self.have_orientation.append(False) @@ -514,12 +527,17 @@ class LayoutChecker(Minifyer): elif 'collection' == name: if 'name' not in attrs: self.handleError('Element collection missing attribute name') + elif not self.VARPATTERN.match(attrs['name']): + if attrs['name'] not in self.current_collections: + self.current_collections[attrs['name']] = self.formatLocation() + else: + self.handleError('Element collection has duplicate name (previous %s)' % (self.current_collections[attrs['name']], )) if attrs.get('visible', 'yes') not in self.YESNO: self.handleError('Element collection attribute visible "%s" is not "yes" or "no"' % (attrs['visible'], )) if not self.has_collection: self.has_collection = True if self.has_legacy_object: - self.handleError('Layout contains collection as well as legacy backdrop/bezel elements') + self.handleError('Layout contains collection as well as legacy backdrop elements') self.variable_scopes.append({ }) self.collection_depth += 1 elif 'param' == name: @@ -543,6 +561,7 @@ class LayoutChecker(Minifyer): elif self.repeat_depth[-1]: self.repeat_depth[-1] -= 1 else: + self.current_collections = None self.repeat_depth.pop() self.have_bounds.pop() self.handlers.pop() @@ -585,6 +604,8 @@ class LayoutChecker(Minifyer): self.views.clear() self.referenced_elements.clear() self.referenced_groups.clear() + self.group_collections.clear() + self.current_collections = None del self.handlers del self.ignored_depth del self.variable_scopes diff --git a/src/mame/layout/mephisto_alm16.lay b/src/mame/layout/mephisto_alm16.lay index 4d12072442b..7484a9eb13a 100644 --- a/src/mame/layout/mephisto_alm16.lay +++ b/src/mame/layout/mephisto_alm16.lay @@ -107,77 +107,77 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -191,14 +191,14 @@ license:CC0 - - - - - - - - + + + + + + + + @@ -206,23 +206,23 @@ license:CC0 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -292,57 +292,6 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -352,34 +301,85 @@ license:CC0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -418,38 +418,38 @@ license:CC0 - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - + @@ -457,11 +457,11 @@ license:CC0 - - - - + + + + @@ -469,23 +469,23 @@ license:CC0 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mephisto_alm32.lay b/src/mame/layout/mephisto_alm32.lay index 728ca07ff14..3f6faed7a5f 100644 --- a/src/mame/layout/mephisto_alm32.lay +++ b/src/mame/layout/mephisto_alm32.lay @@ -107,77 +107,77 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -191,14 +191,14 @@ license:CC0 - - - - - - - - + + + + + + + + @@ -206,23 +206,23 @@ license:CC0 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -292,57 +292,6 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -352,34 +301,85 @@ license:CC0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -418,38 +418,38 @@ license:CC0 - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - + @@ -457,11 +457,11 @@ license:CC0 - - - - + + + + @@ -469,23 +469,23 @@ license:CC0 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mephisto_gen32.lay b/src/mame/layout/mephisto_gen32.lay index 9913f614259..62b3a801700 100644 --- a/src/mame/layout/mephisto_gen32.lay +++ b/src/mame/layout/mephisto_gen32.lay @@ -107,77 +107,77 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -191,14 +191,14 @@ license:CC0 - - - - - - - - + + + + + + + + @@ -206,23 +206,23 @@ license:CC0 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -292,57 +292,6 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -352,34 +301,85 @@ license:CC0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -418,38 +418,38 @@ license:CC0 - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - + @@ -457,11 +457,11 @@ license:CC0 - - - - + + + + @@ -469,23 +469,23 @@ license:CC0 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/mephisto_polgar.lay b/src/mame/layout/mephisto_polgar.lay index bd7db6df192..22cc4d69f5a 100644 --- a/src/mame/layout/mephisto_polgar.lay +++ b/src/mame/layout/mephisto_polgar.lay @@ -108,77 +108,77 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -192,14 +192,14 @@ license:CC0 - - - - - - - - + + + + + + + + @@ -207,23 +207,23 @@ license:CC0 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -282,82 +282,82 @@ license:CC0 - - - - - + + + + + - - - + + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -376,26 +376,8 @@ license:CC0 - - - - - - - - - - - - - - - - - - @@ -404,14 +386,32 @@ license:CC0 - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -419,28 +419,28 @@ license:CC0 - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/saitek_intchess.lay b/src/mame/layout/saitek_intchess.lay index 2ae9fc1dd65..b257059a1eb 100644 --- a/src/mame/layout/saitek_intchess.lay +++ b/src/mame/layout/saitek_intchess.lay @@ -69,11 +69,6 @@ license:CC0 - - - - - @@ -145,42 +140,47 @@ license:CC0 + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/layout/saitek_risc2500.lay b/src/mame/layout/saitek_risc2500.lay index 69e2b3ae6e6..117cc5260be 100644 --- a/src/mame/layout/saitek_risc2500.lay +++ b/src/mame/layout/saitek_risc2500.lay @@ -166,100 +166,100 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -318,82 +318,82 @@ license:CC0 - - - - - + + + + + - - - + + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -403,31 +403,32 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -436,55 +437,6 @@ license:CC0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -495,25 +447,74 @@ license:CC0 - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-70-g09d2