ppapi/generate_ppapi_size_checks.py
def CheckAndInsert(typeinfo, typeinfo_map):
  """Check if a TypeInfo exists already in the given map with the same name.  If
  so, make sure the size is consistent.
  - If the name exists but the sizes do not match, print a message and
    exit with non-zero exit code.
  - If the name exists and the sizes match, do nothing.
  - If the name does not exist, insert the typeinfo in to the map.

  """
  # If the type is unnamed, ignore it.
  if typeinfo.name == "":
    return
  # If the size is 0, ignore it.
  elif int(typeinfo.size) == 0:
    return
  # If the type is not defined under ppapi, ignore it.
  elif typeinfo.source_location.filename.find("ppapi") == -1:
    return
  # If the type is defined under GLES2, ignore it.
  elif typeinfo.source_location.filename.find("GLES2") > -1:
    return
  # If the type is an interface (by convention, starts with PPP_ or PPB_),
  # ignore it.
  elif (typeinfo.name[:4] == "PPP_") or (typeinfo.name[:4] == "PPB_"):
    return
  elif typeinfo.name in typeinfo_map:
    if typeinfo.size != typeinfo_map[typeinfo.name].size:
      print("Error: '" + typeinfo.name + "' is", \
          typeinfo_map[typeinfo.name].size, \
          "bytes on target '" + typeinfo_map[typeinfo.name].target + \
          "', but", typeinfo.size, "on target '" + typeinfo.target + "'")
      print(typeinfo_map[typeinfo.name].parsed_line)
      print(typeinfo.parsed_line)
      sys.exit(1)
    else:
      # It's already in the map and the sizes match.
      pass
  else:
    typeinfo_map[typeinfo.name] = typeinfo
Check if a TypeInfo exists already in the given map with the same name.  If
  so, make sure the size is consistent.
  - If the name exists but the sizes do not match, print a message and
    exit with non-zero exit code.
  - If the name exists and the sizes match, do nothing.
  - If the name does not exist, insert the typeinfo in to the map.

  
Check if a TypeInfo exists already in the given map with the same name.  If
so, make sure the size is consistent.
If the name exists but the sizes do not match, print a message and
exit with non-zero exit code.
If the name exists and the sizes match, do nothing.
If the name does not exist, insert the typeinfo in to the map.
Check if a TypeInfo exists already in the given map with the same name . If so make sure the size is consistent . If the name exists but the sizes do not match print a message and exit with non - zero exit code . If the name exists and the sizes match do nothing . If the name does not exist insert the typeinfo in to the map .
def CheckAndInsert(typeinfo, typeinfo_map):
  if typeinfo.name == "":
    return
  elif int(typeinfo.size) == 0:
    return
  elif typeinfo.source_location.filename.find("ppapi") == -1:
    return
  elif typeinfo.source_location.filename.find("GLES2") > -1:
    return
  elif (typeinfo.name[:4] == "PPP_") or (typeinfo.name[:4] == "PPB_"):
    return
  elif typeinfo.name in typeinfo_map:
    if typeinfo.size != typeinfo_map[typeinfo.name].size:
      print("Error: '" + typeinfo.name + "' is", \
          typeinfo_map[typeinfo.name].size, \
          "bytes on target '" + typeinfo_map[typeinfo.name].target + \
          "', but", typeinfo.size, "on target '" + typeinfo.target + "'")
      print(typeinfo_map[typeinfo.name].parsed_line)
      print(typeinfo.parsed_line)
      sys.exit(1)
    else:
      pass
  else:
    typeinfo_map[typeinfo.name] = typeinfo
def CheckAndInsert ( typeinfo , typeinfo_map ) : if typeinfo . name == "" : return elif int ( typeinfo . size ) == 0 : return elif typeinfo . source_location . filename . find ( "ppapi" ) == - 1 : return elif typeinfo . source_location . filename . find ( "GLES2" ) > - 1 : return elif ( typeinfo . name [ : 4 ] == "PPP_" ) or ( typeinfo . name [ : 4 ] == "PPB_" ) : return elif typeinfo . name in typeinfo_map : if typeinfo . size != typeinfo_map [ typeinfo . name ] . size : print ( "Error: '" + typeinfo . name + "' is" , typeinfo_map [ typeinfo . name ] . size , "bytes on target '" + typeinfo_map [ typeinfo . name ] . target + "', but" , typeinfo . size , "on target '" + typeinfo . target + "'" ) print ( typeinfo_map [ typeinfo . name ] . parsed_line ) print ( typeinfo . parsed_line ) sys . exit ( 1 ) else : pass else : typeinfo_map [ typeinfo . name ] = typeinfo
Check if a TypeInfo exists already in the given map with the same name.
Check if a TypeInfo exists already in the given map with the same name .
"""Check if a TypeInfo exists already in the given map with the same name.  If
  so, make sure the size is consistent.
  - If the name exists but the sizes do not match, print a message and
    exit with non-zero exit code.
  - If the name exists and the sizes match, do nothing.
  - If the name does not exist, insert the typeinfo in to the map.

  """ # If the type is unnamed, ignore it. # If the size is 0, ignore it. # If the type is not defined under ppapi, ignore it. # If the type is defined under GLES2, ignore it. # If the type is an interface (by convention, starts with PPP_ or PPB_), # ignore it. # It's already in the map and the sizes match.
typeinfo
typeinfo_map