2020 * License, v. 2.0. If a copy of the MPL was not distributed with this
2121 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2222
23- /* Autogenerated file created by components/style/gecko/binding_tools/ regen_atoms.py, DO NOT EDIT DIRECTLY */
23+ /* Autogenerated file created by components/style/gecko/regen_atoms.py, DO NOT EDIT DIRECTLY */
2424""" [1 :] # NOQA: E501
2525
2626
27- def gnu_symbolify (source , ident ):
28- return "_ZN{}{}{}{}E" .format (len (source .CLASS ), source .CLASS , len (ident ), ident )
27+ PATTERN = re .compile ('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)' ,
28+ re .MULTILINE )
29+ FILE = "include/nsGkAtomList.h"
30+ CLASS = "nsGkAtoms"
2931
3032
31- def msvc64_symbolify ( source , ident , ty ):
32- return "?{}@{}@@2PEAV{}@@EA " .format (ident , source . CLASS , ty )
33+ def gnu_symbolify ( ident ):
34+ return "_ZN{}{}{}{}E " .format (len ( CLASS ), CLASS , len ( ident ), ident )
3335
3436
35- def msvc32_symbolify (source , ident , ty ):
36- # Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
37- # See https://github.com/rust-lang/rust/issues/36097
38- return "\\ x01?{}@{}@@2PAV{}@@A" .format (ident , source .CLASS , ty )
39-
40-
41- class GkAtomSource :
42- PATTERN = re .compile ('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)' ,
43- re .MULTILINE )
44- FILE = "include/nsGkAtomList.h"
45- CLASS = "nsGkAtoms"
37+ def msvc64_symbolify (ident , ty ):
38+ return "?{}@{}@@2PEAV{}@@EA" .format (ident , CLASS , ty )
4639
4740
48- SOURCES = [
49- GkAtomSource ,
50- ]
41+ def msvc32_symbolify (ident , ty ):
42+ # Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
43+ # See https://github.com/rust-lang/rust/issues/36097
44+ return "\\ x01?{}@{}@@2PAV{}@@A" .format (ident , CLASS , ty )
5145
5246
5347def map_atom (ident ):
@@ -58,11 +52,10 @@ def map_atom(ident):
5852
5953
6054class Atom :
61- def __init__ (self , source , ident , value , ty , atom_type ):
62- self .ident = "{}_{}" .format (source . CLASS , ident )
55+ def __init__ (self , ident , value , ty , atom_type ):
56+ self .ident = "{}_{}" .format (CLASS , ident )
6357 self .original_ident = ident
6458 self .value = value
65- self .source = source
6659 # The Gecko type: "nsStaticAtom", "nsICSSPseudoElement", or "nsIAnonBoxPseudo"
6760 self .ty = ty
6861 # The type of atom: "Atom", "PseudoElement", "NonInheritingAnonBox",
@@ -73,17 +66,14 @@ def __init__(self, source, ident, value, ty, atom_type):
7366 if self .is_anon_box ():
7467 assert self .is_inheriting_anon_box () or self .is_non_inheriting_anon_box ()
7568
76- def cpp_class (self ):
77- return self .source .CLASS
78-
7969 def gnu_symbol (self ):
80- return gnu_symbolify (self .source , self . original_ident )
70+ return gnu_symbolify (self .original_ident )
8171
8272 def msvc32_symbol (self ):
83- return msvc32_symbolify (self .source , self . original_ident , self .ty )
73+ return msvc32_symbolify (self .original_ident , self .ty )
8474
8575 def msvc64_symbol (self ):
86- return msvc64_symbolify (self .source , self . original_ident , self .ty )
76+ return msvc64_symbolify (self .original_ident , self .ty )
8777
8878 def type (self ):
8979 return self .ty
@@ -109,13 +99,12 @@ def is_tree_pseudo_element(self):
10999
110100def collect_atoms (objdir ):
111101 atoms = []
112- for source in SOURCES :
113- path = os .path .abspath (os .path .join (objdir , source .FILE ))
114- print ("cargo:rerun-if-changed={}" .format (path ))
115- with open (path ) as f :
116- content = f .read ()
117- for result in source .PATTERN .finditer (content ):
118- atoms .append (Atom (source , result .group (1 ), result .group (2 ), result .group (3 ), result .group (4 )))
102+ path = os .path .abspath (os .path .join (objdir , FILE ))
103+ print ("cargo:rerun-if-changed={}" .format (path ))
104+ with open (path ) as f :
105+ content = f .read ()
106+ for result in PATTERN .finditer (content ):
107+ atoms .append (Atom (result .group (1 ), result .group (2 ), result .group (3 ), result .group (4 )))
119108 return atoms
120109
121110
0 commit comments