Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members

readtags.h

00001 /*
00002 *   $Id: readtags_8h-source.html,v 1.11 2004/05/02 16:58:48 heicom Exp $
00003 *
00004 *   Copyright (c) 1996-2003, Darren Hiebert
00005 *
00006 *   This source code is released for the public domain.
00007 *
00008 *   This file defines the public interface for looking up tag entries in tag
00009 *   files.
00010 *
00011 *   The functions defined in this interface are intended to provide tag file
00012 *   support to a software tool. The tag lookups provided are sufficiently fast
00013 *   enough to permit opening a sorted tag file, searching for a matching tag,
00014 *   then closing the tag file each time a tag is looked up (search times are
00015 *   on the order of hundreths of a second, even for huge tag files). This is
00016 *   the recommended use of this library for most tool applications. Adhering
00017 *   to this approach permits a user to regenerate a tag file at will without
00018 *   the tool needing to detect and resynchronize with changes to the tag file.
00019 *   Even for an unsorted 24MB tag file, tag searches take about one second.
00020 */
00021 #ifndef READTAGS_H
00022 #define READTAGS_H
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /*
00029 *  MACROS
00030 */
00031 
00033 typedef enum {
00034     TAG_UNSORTED, TAG_SORTED, TAG_FOLDSORTED
00035 } sortType ;
00036 
00037 /* Options for tagsFind() */
00038 #define TAG_FULLMATCH     0x0
00039 #define TAG_PARTIALMATCH  0x1
00040 
00041 #define TAG_OBSERVECASE   0x0
00042 #define TAG_IGNORECASE    0x2
00043 
00044 /*
00045 *  DATA DECLARATIONS
00046 */
00047 
00048 typedef enum { TagFailure = 0, TagSuccess = 1 } tagResult;
00049 
00050 struct sTagFile;
00051 
00052 typedef struct sTagFile tagFile;
00053 
00055 typedef struct {
00056 
00057     struct {
00058         /* was the tag file successfully opened? */
00059         int opened;
00060 
00061         /* errno value when 'opened' is false */
00062         int error_number;
00063     }status;
00064 
00065         /* information about the structure of the tag file */
00066     struct {
00067         /* format of tag file (1 = original, 2 = extended) */
00068         short format;
00069 
00070         /* how is the tag file sorted? */
00071         sortType sort;
00072     } file;
00073 
00074 
00075     /* information about the program which created this tag file */
00076     struct {
00077         /* name of author of generating program (may be null) */
00078         const char *author;
00079 
00080         /* name of program (may be null) */
00081         const char *name;
00082 
00083         /* URL of distribution (may be null) */
00084         const char *url;
00085 
00086         /* program version (may be null) */
00087         const char *version;
00088     } program;
00089 
00090 } tagFileInfo;
00091 
00095 typedef struct {
00096 
00098     const char *key;
00099 
00101     const char *value;
00102 
00103 } tagExtensionField;
00104 
00106 typedef struct {
00107 
00109     const char *name;
00110 
00112     const char *file;
00113 
00115     struct {
00118         const char *pattern;
00119 
00122         unsigned long lineNumber;
00123     } address;
00124 
00126     const char *kind;
00127 
00129     short fileScope;
00130 
00132     struct {
00134         unsigned short count;
00135 
00137         tagExtensionField *list;
00138     } fields;
00139 
00140 } tagEntry;
00141 
00142 
00143 /*
00144 *  FUNCTION PROTOTYPES
00145 */
00146 
00158 extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info);
00159 
00173 extern tagResult tagsSetSortType (tagFile *const file, const sortType type);
00174 
00182 extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry);
00183 
00192 extern tagResult tagsNext (tagFile *const file, tagEntry *const entry);
00193 
00201 extern const char *tagsField (const tagEntry *const entry, const char *const key);
00202 
00228 extern tagResult tagsFind (tagFile *const file, tagEntry *const entry, const char *const name, const int options);
00229 
00237 extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry);
00238 
00244 extern tagResult tagsClose (tagFile *const file);
00245 
00246 #ifdef __cplusplus
00247 };
00248 #endif
00249 
00250 #endif
00251 
00252 /* vi:set tabstop=8 shiftwidth=4: */

Generated on Sun May 2 20:02:58 2004 by doxygen 1.3.2