code: def preprocess(
      source,
      *,
      incldirs=None,
      includes=None,
      macros=None,
      samefiles=None,
      filename=None,
      cwd=None,
      tool=True,
  ):
      """...
  
      CWD should be the project root and "source" should be relative.
      """
      if tool:
          if not cwd:
              cwd = os.getcwd()
          logger.debug(f"CWD:       {cwd!r}")
          logger.debug(f"incldirs:  {incldirs!r}")
          logger.debug(f"includes:  {includes!r}")
          logger.debug(f"macros:    {macros!r}")
          logger.debug(f"samefiles: {samefiles!r}")
          _preprocess = _get_preprocessor(tool)
          with _good_file(source, filename) as source:
              return (
                  _preprocess(
                      source,
                      incldirs,
                      includes,
                      macros,
                      samefiles,
                      cwd,
                  )
                  or ()
              )
      else:
          source, filename = _resolve_source(source, filename)
          # We ignore "includes", "macros", etc.
          return _pure.preprocess(source, filename, cwd)
  
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 1 for calling a global function with example usage: preprocess(source) and returns: _pure, unknown