code: def get_preprocessor(
      *,
      file_macros=None,
      file_includes=None,
      file_incldirs=None,
      file_same=None,
      ignore_exc=False,
      log_err=None,
  ):
      _preprocess = preprocess
      if file_macros:
          file_macros = tuple(_parse_macros(file_macros))
      if file_includes:
          file_includes = tuple(_parse_includes(file_includes))
      if file_incldirs:
          file_incldirs = tuple(_parse_incldirs(file_incldirs))
      if file_same:
          file_same = dict(file_same or ())
      if not callable(ignore_exc):
          ignore_exc = lambda exc, _ig=ignore_exc: _ig
  
      def get_file_preprocessor(filename):
          filename = filename.strip()
          if file_macros:
              macros = list(_resolve_file_values(filename, file_macros))
          if file_includes:
              # There's a small chance we could need to filter out any
              # includes that import "filename".  It isn't clear that it's
              # a problem any longer.  If we do end up filtering then
              # it may make sense to use c_common.fsutil.match_path_tail().
              includes = [
                  i
                  for i, in _resolve_file_values(
                      filename, file_includes
                  )
              ]
          if file_incldirs:
              incldirs = [
                  v
                  for v, in _resolve_file_values(
                      filename, file_incldirs
                  )
              ]
          if file_same:
              samefiles = _resolve_samefiles(filename, file_same)
  
          def preprocess(**kwargs):
              if file_macros and "macros" not in kwargs:
                  kwargs["macros"] = macros
              if file_includes and "includes" not in kwargs:
                  kwargs["includes"] = includes
              if file_incldirs and "incldirs" not in kwargs:
                  kwargs["incldirs"] = incldirs
              if file_same and "samefiles" not in kwargs:
                  kwargs["samefiles"] = samefiles
              kwargs.setdefault("filename", filename)
              with handling_errors(ignore_exc, log_err=log_err):
                  return _preprocess(filename, **kwargs)
  
          return preprocess
  
      return get_file_preprocessor
  
imports: import contextlib
  import logging
  import os
  import os.path
  import platform
  import re
  import sys
  from c_common.fsutil import match_glob
  from c_common.tables import parse_table
  from ..source import resolve, good_file
  from .None import errors
  from .None import pure, gcc
  from .errors import PreprocessorError, PreprocessorFailure, ErrorDirectiveError, MissingDependenciesError, OSMismatchError
  from .common import FileInfo, SourceLine
label_desc: Use image node_id 2 for calling a global function with example usage: get_preprocessor() and returns: get_file_preprocessor, preprocess, _preprocess