mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
style: Remove support for multiple static atom sources.
Differential Revision: https://phabricator.services.mozilla.com/D3285
This commit is contained in:
parent
f75419dd7a
commit
f86e9a411a
1 changed files with 24 additions and 35 deletions
|
@ -20,34 +20,28 @@ PRELUDE = """
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/* Autogenerated file created by components/style/gecko/binding_tools/regen_atoms.py, DO NOT EDIT DIRECTLY */
|
/* Autogenerated file created by components/style/gecko/regen_atoms.py, DO NOT EDIT DIRECTLY */
|
||||||
"""[1:] # NOQA: E501
|
"""[1:] # NOQA: E501
|
||||||
|
|
||||||
|
|
||||||
def gnu_symbolify(source, ident):
|
|
||||||
return "_ZN{}{}{}{}E".format(len(source.CLASS), source.CLASS, len(ident), ident)
|
|
||||||
|
|
||||||
|
|
||||||
def msvc64_symbolify(source, ident, ty):
|
|
||||||
return "?{}@{}@@2PEAV{}@@EA".format(ident, source.CLASS, ty)
|
|
||||||
|
|
||||||
|
|
||||||
def msvc32_symbolify(source, ident, ty):
|
|
||||||
# Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
|
|
||||||
# See https://github.com/rust-lang/rust/issues/36097
|
|
||||||
return "\\x01?{}@{}@@2PAV{}@@A".format(ident, source.CLASS, ty)
|
|
||||||
|
|
||||||
|
|
||||||
class GkAtomSource:
|
|
||||||
PATTERN = re.compile('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)',
|
PATTERN = re.compile('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)',
|
||||||
re.MULTILINE)
|
re.MULTILINE)
|
||||||
FILE = "include/nsGkAtomList.h"
|
FILE = "include/nsGkAtomList.h"
|
||||||
CLASS = "nsGkAtoms"
|
CLASS = "nsGkAtoms"
|
||||||
|
|
||||||
|
|
||||||
SOURCES = [
|
def gnu_symbolify(ident):
|
||||||
GkAtomSource,
|
return "_ZN{}{}{}{}E".format(len(CLASS), CLASS, len(ident), ident)
|
||||||
]
|
|
||||||
|
|
||||||
|
def msvc64_symbolify(ident, ty):
|
||||||
|
return "?{}@{}@@2PEAV{}@@EA".format(ident, CLASS, ty)
|
||||||
|
|
||||||
|
|
||||||
|
def msvc32_symbolify(ident, ty):
|
||||||
|
# Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
|
||||||
|
# See https://github.com/rust-lang/rust/issues/36097
|
||||||
|
return "\\x01?{}@{}@@2PAV{}@@A".format(ident, CLASS, ty)
|
||||||
|
|
||||||
|
|
||||||
def map_atom(ident):
|
def map_atom(ident):
|
||||||
|
@ -58,11 +52,10 @@ def map_atom(ident):
|
||||||
|
|
||||||
|
|
||||||
class Atom:
|
class Atom:
|
||||||
def __init__(self, source, ident, value, ty, atom_type):
|
def __init__(self, ident, value, ty, atom_type):
|
||||||
self.ident = "{}_{}".format(source.CLASS, ident)
|
self.ident = "{}_{}".format(CLASS, ident)
|
||||||
self.original_ident = ident
|
self.original_ident = ident
|
||||||
self.value = value
|
self.value = value
|
||||||
self.source = source
|
|
||||||
# The Gecko type: "nsStaticAtom", "nsICSSPseudoElement", or "nsIAnonBoxPseudo"
|
# The Gecko type: "nsStaticAtom", "nsICSSPseudoElement", or "nsIAnonBoxPseudo"
|
||||||
self.ty = ty
|
self.ty = ty
|
||||||
# The type of atom: "Atom", "PseudoElement", "NonInheritingAnonBox",
|
# The type of atom: "Atom", "PseudoElement", "NonInheritingAnonBox",
|
||||||
|
@ -73,17 +66,14 @@ class Atom:
|
||||||
if self.is_anon_box():
|
if self.is_anon_box():
|
||||||
assert self.is_inheriting_anon_box() or self.is_non_inheriting_anon_box()
|
assert self.is_inheriting_anon_box() or self.is_non_inheriting_anon_box()
|
||||||
|
|
||||||
def cpp_class(self):
|
|
||||||
return self.source.CLASS
|
|
||||||
|
|
||||||
def gnu_symbol(self):
|
def gnu_symbol(self):
|
||||||
return gnu_symbolify(self.source, self.original_ident)
|
return gnu_symbolify(self.original_ident)
|
||||||
|
|
||||||
def msvc32_symbol(self):
|
def msvc32_symbol(self):
|
||||||
return msvc32_symbolify(self.source, self.original_ident, self.ty)
|
return msvc32_symbolify(self.original_ident, self.ty)
|
||||||
|
|
||||||
def msvc64_symbol(self):
|
def msvc64_symbol(self):
|
||||||
return msvc64_symbolify(self.source, self.original_ident, self.ty)
|
return msvc64_symbolify(self.original_ident, self.ty)
|
||||||
|
|
||||||
def type(self):
|
def type(self):
|
||||||
return self.ty
|
return self.ty
|
||||||
|
@ -109,13 +99,12 @@ class Atom:
|
||||||
|
|
||||||
def collect_atoms(objdir):
|
def collect_atoms(objdir):
|
||||||
atoms = []
|
atoms = []
|
||||||
for source in SOURCES:
|
path = os.path.abspath(os.path.join(objdir, FILE))
|
||||||
path = os.path.abspath(os.path.join(objdir, source.FILE))
|
|
||||||
print("cargo:rerun-if-changed={}".format(path))
|
print("cargo:rerun-if-changed={}".format(path))
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
for result in source.PATTERN.finditer(content):
|
for result in PATTERN.finditer(content):
|
||||||
atoms.append(Atom(source, result.group(1), result.group(2), result.group(3), result.group(4)))
|
atoms.append(Atom(result.group(1), result.group(2), result.group(3), result.group(4)))
|
||||||
return atoms
|
return atoms
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue