parameters: (header, fixed_header, declarations=[])
docstring: Rewrites a MIG-generated header (.h) file.
  
      Rewrites the file at |header| by placing it inside an “extern "C"” block, so
      that it declares things properly when included by a C++ compilation unit.
      |declarations| can be a list of additional declarations to place inside the
      “extern "C"” block after the original contents of |header|.
  
      If |fixed_header| is None or not provided, overwrites the original;
      otherwise, puts the result in the file at |fixed_header|.
docstring_summary: Rewrites a MIG-generated header (.h) file.
docstring_tokens: Rewrites a MIG - generated header ( . h ) file .
function: def _fix_header(header, fixed_header, declarations=[]):
      """Rewrites a MIG-generated header (.h) file.
  
      Rewrites the file at |header| by placing it inside an “extern "C"” block, so
      that it declares things properly when included by a C++ compilation unit.
      |declarations| can be a list of additional declarations to place inside the
      “extern "C"” block after the original contents of |header|.
  
      If |fixed_header| is None or not provided, overwrites the original;
      otherwise, puts the result in the file at |fixed_header|.
      """
  
      file = open(header, 'r+' if fixed_header is None else 'r')
      contents = file.read()
      declarations_text = ''.join(declarations)
      contents = '''\
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  %s
  %s
  #ifdef __cplusplus
  }
  #endif
  ''' % (contents, declarations_text)
  
      if fixed_header is None:
          file.seek(0)
          file.truncate()
      else:
          file.close()
          file = open(fixed_header, 'w')
      file.write(contents)
      file.close()
function_tokens: def _fix_header ( header , fixed_header , declarations = [ ] ) : file = open ( header , 'r+' if fixed_header is None else 'r' ) contents = file . read ( ) declarations_text = '' . join ( declarations ) contents = '''\
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  %s
  %s
  #ifdef __cplusplus
  }
  #endif
  ''' % ( contents , declarations_text ) if fixed_header is None : file . seek ( 0 ) file . truncate ( ) else : file . close ( ) file = open ( fixed_header , 'w' ) file . write ( contents ) file . close ( )