xref: /Universal-ctags/main/kind_p.h (revision bc1fa0167c9a99bd1acb7d5d5851605f5f26b069)
1 /*
2 *   Copyright (c) 1998-2003, Darren Hiebert
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 */
8 #ifndef CTAGS_MAIN_KIND_PRIVATE_H
9 #define CTAGS_MAIN_KIND_PRIVATE_H
10 
11 /*
12 *   INCLUDE FILES
13 */
14 
15 #include "general.h"
16 #include "kind.h"
17 #include "vstring.h"
18 
19 
20 /*
21 *   DATA DECLARATIONS
22 */
23 
24 struct kindControlBlock;
25 typedef void (* freeKindDefFunc) (kindDefinition *);
26 typedef void (* freeRoleDefFunc) (roleDefinition *);
27 
28 
29 /*
30 *   FUNCTION PROTOTYPES
31 */
32 extern void enableKind (kindDefinition *kind, bool enable);
33 extern void enableRole (roleDefinition *role, bool enable);
34 extern const char *renderRole (const roleDefinition* const def, vString* b);
35 
36 extern struct kindControlBlock* allocKindControlBlock (parserDefinition *parser);
37 extern void freeKindControlBlock (struct kindControlBlock* kcb);
38 
39 extern int  defineKind (struct kindControlBlock* kcb, kindDefinition *def,
40 						freeKindDefFunc freeKindDef);
41 extern int defineRole (struct kindControlBlock* kcb, int kindIndex,
42 					   roleDefinition *def, freeRoleDefFunc freeRoleDef);
43 extern bool isRoleEnabled (struct kindControlBlock* kcb, int kindIndex, int roleIndex);
44 
45 extern unsigned int countKinds (struct kindControlBlock* kcb);
46 extern unsigned int countRoles (struct kindControlBlock* kcb, int kindIndex);
47 extern kindDefinition *getKind (struct kindControlBlock* kcb, int kindIndex);
48 extern kindDefinition *getKindForLetter (struct kindControlBlock* kcb, char letter);
49 extern kindDefinition *getKindForName (struct kindControlBlock* kcb, const char* name);
50 extern int getKindIndexForLetter (struct kindControlBlock* kcb, char letter);
51 extern int getKindIndexForName (struct kindControlBlock* kcb, const char* name);
52 extern roleDefinition* getRole(struct kindControlBlock* kcb, int kindIndex, int roleIndex);
53 extern roleDefinition* getRoleForName(struct kindControlBlock* kcb, int kindIndex, const char* name);
54 extern void linkKindDependency (struct kindControlBlock *masterKCB,
55 								struct kindControlBlock *slaveKCB);
56 
57 extern int defineScopeSeparator(struct kindControlBlock* kcb,
58 								int kindIndex,
59 								int parentKindIndex, const char *separator);
60 extern const  scopeSeparator *getScopeSeparator(struct kindControlBlock* kcb, int kindIndex, int parentKindIndex);
61 
62 /* for the obsolete --list-kinds option */
63 extern void printKind (const kindDefinition* const kind, bool indent);
64 
65 /* for --list-kinds-full option. LANGUAGE must be initialized. */
66 extern struct colprintTable * kindColprintTableNew (void);
67 extern void kindColprintAddLanguageLines (struct colprintTable *table,
68 										  struct kindControlBlock* kcb);
69 extern void kindColprintTablePrint (struct colprintTable *table, bool noparser,
70 									bool withListHeader, bool machinable, FILE *fp);
71 
72 extern struct colprintTable * roleColprintTableNew (void);
73 extern void roleColprintAddRoles (struct colprintTable *table,
74 								  struct kindControlBlock* kcb,
75 								  const char *kindspecs);
76 extern void roleColprintTablePrint (struct colprintTable *table, bool noparser,
77 									bool withListHeader, bool machinable, FILE *fp);
78 
79 #ifdef DEBUG
80 extern bool doesParserUseKind (struct kindControlBlock* kcb, char letter);
81 #endif
82 
83 #endif	/* CTAGS_MAIN_KIND_PRIVATE_H */
84