#ifndef cmTagFile_h
#define cmTagFile_h

#ifdef __cplusplus
extern "C" {
#endif

  // Read a ctags file generated by:
  //
  // ctags --c-kinds=+p --fields=+n  file.h
  //
  // --c-kinds=+px 
  //            p - turns on function prototype reporting.
  //            x - turns on external and forward decl
  // --field=+n turns on line number reporting
  enum
  {
    kOkTfRC = cmOkRC,
    kFileFailTfRC,
    kLHeapFailTfRC,
    kSyntaxErrTfRC,
    kFileInvalidTfRC
  };

  typedef unsigned   cmTfRC_t;
  typedef cmHandle_t cmTfH_t;

  extern  cmTfH_t    cmTfNullHandle;

  enum
  {
    kFuncProtoTfFl = 0x001,
    kFuncDefnTfFl  = 0x002,
    kEnumTfFl      = 0x004,
    kMacroTfFl     = 0x008,
    kTypedefTfFl   = 0x010,
    kFieldTfFl     = 0x020,
    kExternTfFl    = 0x040,   // extern var's and forward declarations
    kStructTagTfFl = 0x080,
    kUnionTagTfFl  = 0x100
    // be sure to add new flags to _cmTfFlagsToLabel()
  };

  typedef struct
  {
    unsigned        flags;
    unsigned        line;
    const cmChar_t* label;
  } cmTfTag_t;

  cmTfRC_t         cmTfOpenFile( cmCtx_t* ctx, cmTfH_t* hp, const cmChar_t* fn );
  cmTfRC_t         cmTfCloseFile( cmTfH_t* hp );


  bool             cmTfIsValid( cmTfH_t h );

  unsigned         cmTfCount( cmTfH_t h );
  const cmTfTag_t* cmTfRecd(  cmTfH_t h, unsigned index );

  cmTfRC_t cmTfReport( cmTfH_t h, cmRpt_t* rpt );

  cmTfRC_t cmTfTest( cmCtx_t* ctx, const cmChar_t* fn );

#ifdef __cplusplus
}
#endif

#endif
