docstr: Process function definitions of ES 2.0, WebGL and annotations.
  
  We try to combine information from these three sources to find the
  arguments for the Python API. In this "merging" process we also
  check for inconsistencies between the API definitions.
docstr_tok: ["Process","function","definitions","of","ES","2.0",",","WebGL","and","annotations",".","We","try","to","combine","information","from","these","three","sources","to","find","the","arguments","for","the","Python","API",".","In","this","``","merging","''","process","we","also","check","for","inconsistencies","between","the","API","definitions","."]
code: def collect_function_definitions(self):
      """Process function definitions of ES 2.0, WebGL and annotations.
  
      We try to combine information from these three sources to find the
      arguments for the Python API. In this "merging" process we also
      check for inconsistencies between the API definitions.
  
      """
      for name in self.parser1.function_names:
          if name in IGNORE_FUNCTIONS:
              continue
  
          # Get es2 function
          es2func = self.parser1.functions[name]
  
          # Get webgl version
          lookupname = WEBGL_EQUIVALENTS.get(
              es2func.shortname, es2func.shortname
          )
          wglfunc = self.parser2.functions.get(lookupname, None)
          if wglfunc:
              self.used_webgl_names.add(lookupname)
          else:
              print(
                  "WARNING: %s not available in WebGL"
                  % es2func.shortname
              )
  
          # Convert name
          name = WEBGL_EQUIVALENTS.get(name, name)
  
          # Avoid duplicates for getParameter
          if name == "getParameter":
              if es2func.shortname != "getString":
                  name = "_" + es2func.shortname
  
          # Get annotated version
          annfunc = self.annotations.get(name, None)
  
          # Create description instance
          des = FunctionDescription(name, es2func, wglfunc, annfunc)
          self.all_functions.append(des)
  
          # Get information about arguments
          argnames_es2 = [arg.name for arg in es2func.args[1:]]
          if wglfunc:
              argnames_wgl = [arg.name for arg in wglfunc.args[1:]]
          if annfunc:
              argnames_ann = (
                  annfunc.args
              )  # Can contain 'argname=default'
              argnames_ann = [arg.split("=")[0] for arg in argnames_ann]
  
          # Set argumenets specification of our GL API
          # Also check and report when we deviate from the WebGL API
          if wglfunc and argnames_es2 == argnames_wgl:
              if annfunc and argnames_ann != argnames_es2:
                  des.args = argnames_ann
                  print(
                      "WARNING: %s: Annotation overload even though webgl and es2 match."
                      % name
                  )
              else:
                  des.args = argnames_es2
          elif wglfunc:
              if annfunc and argnames_ann != argnames_wgl:
                  des.args = argnames_ann
                  print(
                      "WARNING: %s: Annotation overload webgl args."
                      % name
                  )
              else:
                  # print('WARNING: %s: assuming wgl args.'%name)
                  des.args = argnames_wgl
          else:
              print("WARNING: %s: Could not determine args!!" % name)
  
          # Go over all functions to test if they are in OpenGL
          for func in [es2func, wglfunc]:
              if func is None:
                  continue
              group = func.group or [func]
              for f in group:
                  # Check opengl
                  if f.oname.startswith("gl") and not hasattr(
                      GL, f.glname
                  ):
                      print(
                          "WARNING: %s seems not available in PyOpenGL"
                          % f.glname
                      )
  
imports: from __future__ import annotations
  import os
  import sys
  import headerparser
  from annotations import parse_anotations
  from OpenGL import GL
label_desc: Use image node_id 2 for calling the FunctionCollector obj's underlying member method code with example usage: obj.collect_function_definitions() without return types