Copyright (C) Kevin Larke 2009-2020

This file is part of libcm.

libcm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

libcm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See the GNU General Public License distributed with the libcm package or look here: .


cmTagFile : Read a 'ctags' output file.

// 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 );