1 /*
2 *   Copyright (c) 2016, Jiri Techet
3 *
4 *   This source code is released for free distribution under the terms of the
5 *   GNU General Public License version 2 or (at your option) any later version.
6 *
7 *   Defines ctags API when compiled as a library.
8 */
9 #ifndef CTAGS_API_H
10 #define CTAGS_API_H
11 
12 #include "general.h"  /* must always come first */
13 
14 #ifdef CTAGS_LIB
15 
16 #include <stdlib.h>
17 #include <stdbool.h>
18 
19 typedef struct {
20 	const char *name;
21 	const char *signature;
22 	const char *scopeName;
23 	const char *inheritance;
24 	const char *varType;
25 	const char *access;
26 	const char *implementation;
27 	char kindLetter;
28 	bool isFileScope;
29 	unsigned long lineNumber;
30 	int lang;
31 } ctagsTag;
32 
33 /* Callback invoked for every tag found by the parser. The return value is
34  * currently unused. */
35 typedef bool (*tagEntryFunction) (const ctagsTag *const tag, void *userData);
36 
37 /* Callback invoked at the beginning of every parsing pass. The return value is
38  * currently unused */
39 typedef bool (*passStartCallback) (void *userData);
40 
41 
42 extern void ctagsInit(void);
43 extern void ctagsParse(unsigned char *buffer, size_t bufferSize,
44 	const char *fileName, const int language,
45 	tagEntryFunction tagCallback, passStartCallback passCallback,
46 	void *userData);
47 extern const char *ctagsGetLangName(int lang);
48 extern int ctagsGetNamedLang(const char *name);
49 extern const char *ctagsGetLangKinds(int lang);
50 extern const char *ctagsGetKindName(char kind, int lang);
51 extern char ctagsGetKindFromName(const char *name, int lang);
52 extern bool ctagsIsUsingRegexParser(int lang);
53 extern unsigned int ctagsGetLangCount(void);
54 
55 #endif /* CTAGS_LIB */
56 
57 #endif  /* CTAGS_API_H */
58