parameters: (fp, g=None)
return_statement: return g
docstring: Parse a config.h-style file.
  
      A dictionary containing name/value pairs is returned.  If an
      optional dictionary is passed in as the second argument, it is
      used instead of a new dictionary.
docstring_summary: Parse a config.h-style file.
docstring_tokens: Parse a config . h - style file .
function: def parse_config_h(fp, g=None):
      """Parse a config.h-style file.
  
      A dictionary containing name/value pairs is returned.  If an
      optional dictionary is passed in as the second argument, it is
      used instead of a new dictionary.
      """
      if g is None:
          g = {}
      define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
      undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
      #
      while 1:
          line = fp.readline()
          if not line:
              break
          m = define_rx.match(line)
          if m:
              n, v = m.group(1, 2)
              try: v = int(v)
              except ValueError: pass
              g[n] = v
          else:
              m = undef_rx.match(line)
              if m:
                  g[m.group(1)] = 0
      return g
function_tokens: def parse_config_h ( fp , g = None ) : if g is None : g = { } define_rx = re . compile ( "#define ([A-Z][A-Za-z0-9_]+) (.*)\n" ) undef_rx = re . compile ( "/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n" ) # while 1 : line = fp . readline ( ) if not line : break m = define_rx . match ( line ) if m : n , v = m . group ( 1 , 2 ) try : v = int ( v ) except ValueError : pass g [ n ] = v else : m = undef_rx . match ( line ) if m : g [ m . group ( 1 ) ] = 0 return g