geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

kind.c
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) 2015, Red Hat, Inc.
4 * Copyright (c) 2015, Masatake YAMATO
5 *
6 * Author: Masatake YAMATO <yamato@redhat.com>
7 *
8 * This source code is released for free distribution under the terms of the
9 * GNU General Public License version 2 or (at your option) any later version.
10 *
11 */
12
13#include "general.h"
14
15#include <ctype.h>
16#include <stdio.h>
17#include <string.h>
18
19#include "colprint_p.h"
20#include "ctags.h"
21#include "debug.h"
22#include "entry.h"
23#include "kind.h"
24#include "parse_p.h"
25#include "options.h"
26#include "ptrarray.h"
27#include "routines.h"
28#include "vstring.h"
29
30typedef struct sRoleObject {
34
37 unsigned int count;
38 int owner;
39};
40
41typedef struct sKindObject {
47
50 unsigned int count;
54};
55
56extern const char *renderRole (const roleDefinition* const role, vString* b)
57{
58 vStringCatS (b, role->name);
59 return vStringValue (b);
60}
61
62extern void printKind (const kindDefinition* const kind, bool indent)
63{
64 printf ("%s%c %s%s\n", indent ? " " : "", kind->letter,
65 kind->description != NULL ? kind->description :
66 (kind->name != NULL ? kind->name : ""),
67 kind->enabled ? "" : " [off]");
68}
69
70extern void enableKind (kindDefinition *kind, bool enable)
71{
72 kindDefinition *slave;
73
74 if (kind->master)
75 enableKind (kind->master, enable);
76 else
77 {
78 kind->enabled = enable;
79 for (slave = kind->slave; slave; slave = slave->slave)
80 slave->enabled = enable;
81 }
82}
83
84extern void enableRole (roleDefinition *role, bool enable)
85{
86 role->enabled = enable;
87}
88
89static void initRoleObject (roleObject *robj, roleDefinition *rdef, freeRoleDefFunc freefunc, int roleId)
90{
91#ifdef DEBUG
92 size_t len = strlen (rdef->name);
93 for (int i = 0; i < len; i++)
94 Assert (isalnum (rdef->name [i]));
95#endif
96 robj->def = rdef;
97 robj->free = freefunc;
98 robj->def->id = roleId;
99}
100
102{
103 unsigned int j;
104 struct roleControlBlock* rcb;
105
106 rcb = xMalloc(1, struct roleControlBlock);
107 rcb->count = kind->def->nRoles;
108 rcb->owner = kind->def->id;
109 rcb->role = xMalloc(rcb->count, roleObject);
110 for (j = 0; j < rcb->count; j++)
111 initRoleObject (rcb->role + j, kind->def->roles + j, NULL, j);
112
113 return rcb;
114}
115
117{
118 unsigned int i;
119 struct kindControlBlock *kcb;
120
121 kcb = xMalloc (1, struct kindControlBlock);
122 kcb->kind = xMalloc (parser->kindCount, kindObject);
123 kcb->count = parser->kindCount;
124 kcb->owner = parser->id;
125
128 if (parser->defaultScopeSeparator)
130
133 if (parser->defaultRootScopeSeparator)
135
136 for (i = 0; i < parser->kindCount; ++i)
137 {
138 kindObject *kind = kcb->kind + i;
139 kind->def = parser->kindTable + i;
140 kind->free = NULL;
141 kind->def->id = i;
144 }
145
146 return kcb;
147}
148
149static void freeRoleControlBlock (struct roleControlBlock *rcb)
150{
151 unsigned int i;
152 for (i = 0; i < rcb->count; ++i)
153 {
154 if (rcb->role[i].free)
155 rcb->role [i].free (rcb->role [i].def);
156 }
157 eFreeNoNullCheck (rcb->role);
158 eFree (rcb);
159}
160
161extern void freeKindControlBlock (struct kindControlBlock* kcb)
162{
163 unsigned int i;
164
165 for (i = 0; i < kcb->count; ++i)
166 {
167 if (kcb->kind [i].free)
168 kcb->kind [i].free (kcb->kind [i].def);
169 freeRoleControlBlock (kcb->kind [i].rcb);
170 if (kcb->kind [i].dynamicSeparators)
172 }
173
178
179 if (kcb->kind)
180 eFree (kcb->kind);
181 eFree (kcb);
182}
183
184extern int defineKind (struct kindControlBlock* kcb, kindDefinition *def,
185 freeKindDefFunc freeKindDef)
186{
187 def->id = kcb->count++;
188 kcb->kind = xRealloc (kcb->kind, kcb->count, kindObject);
189 kcb->kind [def->id].def = def;
190 kcb->kind [def->id].free = freeKindDef;
191 kcb->kind [def->id].rcb = allocRoleControlBlock(kcb->kind + def->id);
192 kcb->kind [def->id].dynamicSeparators = NULL;
193
194 verbose ("Add kind[%d] \"%c,%s,%s\" to %s\n", def->id,
195 def->letter, def->name, def->description,
196 getLanguageName (kcb->owner));
197
198 return def->id;
199}
200
201extern int defineRole (struct kindControlBlock* kcb, int kindIndex,
202 roleDefinition *def, freeRoleDefFunc freeRoleDef)
203{
204 struct roleControlBlock *rcb = kcb->kind[kindIndex].rcb;
205 int roleIndex = rcb->count++;
206
207 if (roleIndex == ROLE_MAX_COUNT)
208 {
209 rcb->count--;
210 error (FATAL, "Too many role definition for kind \"%s\" of language \"%s\" (> %d)",
211 kcb->kind[kindIndex].def->name,
212 getLanguageName (kcb->owner),
213 (int)(ROLE_MAX_COUNT - 1));
214 }
215
216 rcb->role = xRealloc (rcb->role, rcb->count, roleObject);
217 initRoleObject (rcb->role + roleIndex, def, freeRoleDef, roleIndex);
218
219 return roleIndex;
220}
221
222extern bool isRoleEnabled (struct kindControlBlock* kcb, int kindIndex, int roleIndex)
223{
224 roleDefinition *rdef = getRole (kcb, kindIndex, roleIndex);
225 return rdef->enabled;
226}
227
228extern unsigned int countKinds (struct kindControlBlock* kcb)
229{
230 return kcb->count;
231}
232
233extern unsigned int countRoles (struct kindControlBlock* kcb, int kindIndex)
234{
235 return kcb->kind [kindIndex].rcb->count;
236}
237
238extern kindDefinition *getKind (struct kindControlBlock* kcb, int kindIndex)
239{
240 return kcb->kind [kindIndex].def;
241}
242
243extern kindDefinition *getKindForLetter (struct kindControlBlock* kcb, char letter)
244{
245 unsigned int i;
246 kindDefinition * kdef;
247
248 for (i = 0; i < countKinds (kcb); ++i)
249 {
250 kdef = getKind (kcb, i);
251 if (kdef->letter == letter)
252 return kdef;
253 }
254 return NULL;
255}
256
257extern kindDefinition *getKindForName (struct kindControlBlock* kcb, const char* name)
258{
259 unsigned int i;
260 kindDefinition * kdef;
261
262 for (i = 0; i < countKinds (kcb); ++i)
263 {
264 kdef = getKind (kcb, i);
265 Assert(kdef);
266 if (kdef->name && (strcmp(kdef->name, name) == 0))
267 return kdef;
268 }
269 return NULL;
270}
271
272extern int getKindIndexForLetter (struct kindControlBlock* kcb, char letter)
273{
274 unsigned int i;
275 kindDefinition * kdef;
276
277 for (i = 0; i < countKinds (kcb); ++i)
278 {
279 kdef = getKind (kcb, i);
280 if (kdef->letter == letter)
281 return (unsigned int)i;
282 }
283 return KIND_GHOST_INDEX;
284}
285
286extern int getKindIndexForName (struct kindControlBlock* kcb, const char* name)
287{
288 unsigned int i;
289 kindDefinition * kdef;
290
291 for (i = 0; i < countKinds (kcb); ++i)
292 {
293 kdef = getKind (kcb, i);
294 Assert(kdef);
295 if (kdef->name && (strcmp(kdef->name, name) == 0))
296 return (int)i;
297 }
298 return KIND_GHOST_INDEX;
299}
300
301extern roleDefinition* getRole(struct kindControlBlock* kcb, int kindIndex, int roleIndex)
302{
303 struct roleControlBlock *rcb = kcb->kind[kindIndex].rcb;
304 return rcb->role [roleIndex].def;
305}
306
308 int kindIndex, const char* name)
309{
310 unsigned int i;
311 roleDefinition *rdef;
312
313 for (i = 0; i < countRoles (kcb, kindIndex); ++i)
314 {
315 rdef = getRole(kcb, kindIndex, i);
316 Assert(rdef);
317 if (rdef->name && (strcmp(rdef->name, name) == 0))
318 return rdef;
319 }
320 return NULL;
321}
322
323static void linkKinds (langType master, kindDefinition *masterKind, kindDefinition *slaveKind)
324{
326
327 slaveKind->master = masterKind;
328
329 tail = slaveKind;
330 while (tail->slave)
331 {
332 tail->enabled = masterKind->enabled;
333 tail = tail->slave;
334 }
335
336 tail->slave = masterKind->slave;
337 masterKind->slave = slaveKind;
338
339 masterKind->syncWith = master;
340 slaveKind->syncWith = master;
341}
342
343extern void linkKindDependency (struct kindControlBlock *masterKCB,
344 struct kindControlBlock *slaveKCB)
345{
346 unsigned int k_slave, k_master;
347 kindDefinition *kind_slave, *kind_master;
348
349 for (k_slave = 0; k_slave < countKinds (slaveKCB); k_slave++)
350 {
351 kind_slave = getKind(slaveKCB, k_slave);
352 if (kind_slave->syncWith == LANG_AUTO)
353 {
354 for (k_master = 0; k_master < countKinds (masterKCB); k_master++)
355 {
356 kind_master = getKind(masterKCB, k_master);
357 if ((kind_slave->letter == kind_master->letter)
358 && (strcmp (kind_slave->name, kind_master->name) == 0))
359 {
360 linkKinds (masterKCB->owner, kind_master, kind_slave);
361 break;
362 }
363 }
364 }
365 }
366}
367
368static void scopeSeparatorDelete (void *data)
369{
370 scopeSeparator *sep = data;
371 eFree ((void *)sep->separator);
372 sep->separator = NULL;
373 eFree (sep);
374}
375
377 int kindIndex,
378 int parentKindIndex, const char *separator)
379{
380 if (kindIndex == KIND_WILDCARD_INDEX)
381 {
382 if (parentKindIndex == KIND_WILDCARD_INDEX)
383 {
386 verbose ("Installing default separator for %s: %s\n",
387 getLanguageName (kcb->owner), separator);
388 kcb->defaultScopeSeparator.separator = eStrdup (separator);
389 }
390 else if (parentKindIndex == KIND_GHOST_INDEX)
391 {
394 verbose ("Installing default root separator for %s: %s\n",
395 getLanguageName (kcb->owner),
396 separator);
398 }
399 else
400 error (FATAL,
401 "Don't specify a real kind as parent when defining a default scope separator: %d",
402 parentKindIndex);
403 return 0;
404 }
405 Assert (kcb->count > kindIndex);
406 kindObject *kind = kcb->kind + kindIndex;
407
408 if (!kind->dynamicSeparators)
410
412 sep->parentKindIndex = parentKindIndex;
413 sep->separator = eStrdup(separator);
414 ptrArrayAdd (kind->dynamicSeparators, sep);
415
416 return 0;
417}
418
419static scopeSeparator *getScopeSeparatorDynamic(kindObject *kobj, int parentKindIndex)
420{
421 scopeSeparator *sep;
422
423 if (kobj->dynamicSeparators)
424 {
425 for (unsigned int i = ptrArrayCount (kobj->dynamicSeparators); 0 < i ; i--)
426 {
427 sep = ptrArrayItem (kobj->dynamicSeparators, i - 1);
428 if (sep->parentKindIndex == parentKindIndex)
429 return sep;
430 }
431 }
432 return NULL;
433}
434
435static const scopeSeparator *getScopeSeparatorStatic(kindDefinition *kdef, int parentKindIndex)
436{
437 scopeSeparator *table = kdef->separators;
438
439 if (table == NULL)
440 return NULL;
441
442 while (table - kdef->separators < (int)kdef->separatorCount)
443 {
444 if (table->parentKindIndex == parentKindIndex)
445 return table;
446
447 /* If a caller wants a root separator for kdef,
448 we should not return a wildcard table. */
449 if (parentKindIndex != KIND_GHOST_INDEX
451 return table;
452
453 table++;
454 }
455
456 return NULL;
457}
458
460 int kindIndex, int parentKindIndex)
461{
462 Assert (kindIndex != KIND_GHOST_INDEX);
463 Assert (kindIndex != KIND_FILE_INDEX);
464 Assert (kindIndex != KIND_WILDCARD_INDEX);
465
466 Assert (parentKindIndex != KIND_WILDCARD_INDEX);
467 Assert (parentKindIndex != KIND_FILE_INDEX);
468 /* A caller specifies KIND_GHOST_INDEX for parentKindIndex when it
469 * wants root separator. */
470
471 Assert (kcb->count > kindIndex);
472 kindObject *kobj = kcb->kind + kindIndex;
473 const scopeSeparator *sep;
474
475 sep = getScopeSeparatorDynamic (kobj, parentKindIndex);
476 if (sep)
477 return sep;
478
479 sep = getScopeSeparatorStatic (kobj->def, parentKindIndex);
480 if (sep)
481 return sep;
482
483 /* Cannot find a suitable sep definition.
484 * Use default one. */
485 if (parentKindIndex == KIND_GHOST_INDEX)
486 {
488 return &kcb->defaultRootScopeSeparator;
489 return NULL;
490 }
491 else
492 {
494 return &kcb->defaultScopeSeparator;
495
496 static scopeSeparator defaultSeparator = {
497 .separator = ".",
498 .parentKindIndex = KIND_WILDCARD_INDEX,
499 };
500 return &defaultSeparator;
501 }
502}
503
504#ifdef DEBUG
505extern bool doesParserUseKind (struct kindControlBlock* kcb, char letter)
506{
507 unsigned int k;
508 kindDefinition *kdef;
509
510 for (k = 0; k < countKinds (kcb); k++)
511 {
512 kdef = getKind(kcb, k);
513 if (kdef->letter == letter)
514 return true;
515 }
516 return false;
517}
518#endif
519
521{
522 return colprintTableNew ("L:LANGUAGE", "L:LETTER", "L:NAME", "L:ENABLED",
523 "L:REFONLY", "L:NROLES", "L:MASTER",
524 "L:DESCRIPTION",
525 NULL);
526}
527
528static void kindColprintFillLine (struct colprintLine *line,
529 const char *langName,
530 kindDefinition *kdef)
531{
532 langType lang = getNamedLanguage (langName, 0);
533 unsigned int count = countLanguageRoles(lang, kdef->id);
537 ? kdef->name
538 : "ThisShouldNotBePrintedKindNameMustBeGiven");
543 || kdef->slave ) ?
545 colprintLineAppendColumnCString (line, kdef->description? kdef->description: "NO DESCRIPTION GIVEN");
546}
547
549 struct kindControlBlock* kcb)
550{
551 const char *lang = getLanguageName (kcb->owner);
552 for (unsigned int i = 0; i < countKinds (kcb); i++)
553 {
554 kindDefinition *kdef = getKind (kcb, i);
555 struct colprintLine *line = colprintTableGetNewLine(table);
556
557 kindColprintFillLine (line, lang, kdef);
558 }
559}
560
561static int kindColprintCompareLines (struct colprintLine *a , struct colprintLine *b)
562{
563 const char *a_parser = colprintLineGetColumn (a, 0);
564 const char *b_parser = colprintLineGetColumn (b, 0);
565 const char *a_letter;
566 const char *b_letter;
567 int r;
568
569 r = strcmp (a_parser, b_parser);
570 if (r != 0)
571 return r;
572
573 a_letter = colprintLineGetColumn (a, 1);
574 b_letter = colprintLineGetColumn (b, 1);
575 r = strcmp (a_letter, b_letter);
576 if (r != 0)
577 return r;
578
579 return 0;
580}
581
582extern void kindColprintTablePrint (struct colprintTable *table, bool noparser,
583 bool withListHeader, bool machinable, FILE *fp)
584{
586 colprintTablePrint (table, noparser? 1: 0, withListHeader, machinable, fp);
587}
588
589
591{
592 return colprintTableNew ("L:LANGUAGE", "L:KIND(L/N)", "L:NAME",
593 "L:ENABLED", "L:DESCRIPTION", NULL);
594}
595
596extern void roleColprintAddRoles (struct colprintTable *table, struct kindControlBlock *kcb,
597 const char *kindspecs)
598{
599 const char* lang;
600 vString *kind_l_and_n;
601
602 lang = getLanguageName (kcb->owner);
603 kind_l_and_n = vStringNew ();
604 for (const char *c = kindspecs; *c != '\0'; c++)
605 {
606 const char *kname = NULL;
607 size_t kname_len;
608
609 if (*c == '{')
610 {
611 const char *start = c + 1;
612 const char *end = strchr(c, '}');
613
614 if (!end)
615 error (FATAL, "'{' is not closed with '}' in \"%s\"", c);
616 if (start == end)
617 error (FATAL, "empty kind name is given in \"%s\"", c);
618
619 kname = start;
620 kname_len = end - start;
621 c = end;
622 }
623
624 for (unsigned int i = 0; i < countKinds (kcb); i++)
625 {
626 const kindDefinition *k = getKind (kcb, i);
627
628 if ((kname
629 && strlen (k->name) == kname_len
630 && strncmp (k->name, kname, kname_len) == 0)
631 || (!kname && *c == k->letter)
632 || (!kname && *c == KIND_WILDCARD_LETTER))
633 {
634 unsigned int nRoles = countRoles(kcb, i);
635 for (unsigned int j = 0; j < nRoles; j++)
636 {
637 const roleDefinition *r = getRole (kcb, i, j);
638 struct colprintLine *line = colprintTableGetNewLine(table);
639
641
642 vStringPut (kind_l_and_n, k->letter);
643 vStringPut (kind_l_and_n, '/');
644 vStringCatS (kind_l_and_n, k->name);
646 vStringClear (kind_l_and_n);
647
650 r->enabled ? "on" : "off");
652 }
653 if (! (!kname && *c == KIND_WILDCARD_LETTER))
654 break;
655 }
656 }
657 }
658 vStringDelete (kind_l_and_n);
659#if 0
660 if ((i == countKinds (kcb)) && (*c != KIND_WILDCARD) && (!allowMissingKind))
661 error (FATAL, "No such letter kind in %s: %c\n", lang->name, *c);
662#endif
663}
664
665static int roleColprintCompareLines(struct colprintLine *a, struct colprintLine *b)
666{
667 int r;
668
669 const char *a_parser, *b_parser;
670 a_parser = colprintLineGetColumn (a, 0);
671 b_parser = colprintLineGetColumn (b, 0);
672
673 r = strcmp(a_parser, b_parser);
674 if (r != 0)
675 return r;
676
677 const char *a_kindln, *b_kindln;
678 a_kindln = colprintLineGetColumn (a, 1);
679 b_kindln = colprintLineGetColumn (b, 1);
680
681 r = strcmp(a_kindln, b_kindln);
682 if (r != 0)
683 return r;
684
685 const char *a_role, *b_role;
686 a_role = colprintLineGetColumn (a, 2);
687 b_role = colprintLineGetColumn (b, 2);
688
689 return strcmp(a_role, b_role);
690}
691
692extern void roleColprintTablePrint (struct colprintTable *table, bool noparser,
693 bool withListHeader, bool machinable, FILE *fp)
694{
696 colprintTablePrint (table, noparser? 1: 0, withListHeader, machinable, fp);
697}
void colprintLineAppendColumnCString(struct colprintLine *line, const char *column)
Definition: colprint.c:254
void colprintTableSort(struct colprintTable *table, int(*compareFn)(struct colprintLine *, struct colprintLine *))
Definition: colprint.c:235
void colprintLineAppendColumnBool(struct colprintLine *line, bool column)
Definition: colprint.c:280
struct colprintLine * colprintTableGetNewLine(struct colprintTable *table)
Definition: colprint.c:240
struct colprintTable * colprintTableNew(const char *columnHeader,...)
Definition: colprint.c:73
void colprintLineAppendColumnChar(struct colprintLine *line, char column)
Definition: colprint.c:265
void colprintLineAppendColumnVString(struct colprintLine *line, vString *column)
Definition: colprint.c:260
void colprintLineAppendColumnInt(struct colprintLine *line, unsigned int column)
Definition: colprint.c:272
void colprintTablePrint(struct colprintTable *table, unsigned int startFrom, bool withHeader, bool machinable, FILE *fp)
Definition: colprint.c:227
const char * colprintLineGetColumn(struct colprintLine *line, unsigned int column)
Definition: colprint.c:285
#define RSV_NONE
Definition: ctags.h:39
#define Assert(c)
Definition: debug.h:47
const gchar * name
Definition: document.c:3219
static gchar indent[100]
Definition: editor.c:91
#define ROLE_MAX_COUNT
Definition: entry.h:92
void error(const errorSelection selection, const char *const format,...)
Definition: error.c:53
vString * line
Definition: geany_cobol.c:133
unsigned int count
static bool tail(const char *cp)
Definition: geany_pascal.c:70
roleDefinition * getRole(struct kindControlBlock *kcb, int kindIndex, int roleIndex)
Definition: kind.c:301
static void scopeSeparatorDelete(void *data)
Definition: kind.c:368
void roleColprintAddRoles(struct colprintTable *table, struct kindControlBlock *kcb, const char *kindspecs)
Definition: kind.c:596
static int roleColprintCompareLines(struct colprintLine *a, struct colprintLine *b)
Definition: kind.c:665
int getKindIndexForName(struct kindControlBlock *kcb, const char *name)
Definition: kind.c:286
bool isRoleEnabled(struct kindControlBlock *kcb, int kindIndex, int roleIndex)
Definition: kind.c:222
kindDefinition * getKindForLetter(struct kindControlBlock *kcb, char letter)
Definition: kind.c:243
unsigned int countRoles(struct kindControlBlock *kcb, int kindIndex)
Definition: kind.c:233
struct kindControlBlock * allocKindControlBlock(parserDefinition *parser)
Definition: kind.c:116
roleDefinition * getRoleForName(struct kindControlBlock *kcb, int kindIndex, const char *name)
Definition: kind.c:307
struct colprintTable * roleColprintTableNew(void)
Definition: kind.c:590
unsigned int countKinds(struct kindControlBlock *kcb)
Definition: kind.c:228
static void kindColprintFillLine(struct colprintLine *line, const char *langName, kindDefinition *kdef)
Definition: kind.c:528
void kindColprintTablePrint(struct colprintTable *table, bool noparser, bool withListHeader, bool machinable, FILE *fp)
Definition: kind.c:582
void enableKind(kindDefinition *kind, bool enable)
Definition: kind.c:70
int defineKind(struct kindControlBlock *kcb, kindDefinition *def, freeKindDefFunc freeKindDef)
Definition: kind.c:184
const char * renderRole(const roleDefinition *const role, vString *b)
Definition: kind.c:56
static int kindColprintCompareLines(struct colprintLine *a, struct colprintLine *b)
Definition: kind.c:561
kindDefinition * getKind(struct kindControlBlock *kcb, int kindIndex)
Definition: kind.c:238
struct colprintTable * kindColprintTableNew(void)
Definition: kind.c:520
static void linkKinds(langType master, kindDefinition *masterKind, kindDefinition *slaveKind)
Definition: kind.c:323
static struct roleControlBlock * allocRoleControlBlock(kindObject *kind)
Definition: kind.c:101
static scopeSeparator * getScopeSeparatorDynamic(kindObject *kobj, int parentKindIndex)
Definition: kind.c:419
struct sKindObject kindObject
const scopeSeparator * getScopeSeparator(struct kindControlBlock *kcb, int kindIndex, int parentKindIndex)
Definition: kind.c:459
void printKind(const kindDefinition *const kind, bool indent)
Definition: kind.c:62
static const scopeSeparator * getScopeSeparatorStatic(kindDefinition *kdef, int parentKindIndex)
Definition: kind.c:435
void linkKindDependency(struct kindControlBlock *masterKCB, struct kindControlBlock *slaveKCB)
Definition: kind.c:343
static void initRoleObject(roleObject *robj, roleDefinition *rdef, freeRoleDefFunc freefunc, int roleId)
Definition: kind.c:89
void freeKindControlBlock(struct kindControlBlock *kcb)
Definition: kind.c:161
void enableRole(roleDefinition *role, bool enable)
Definition: kind.c:84
struct sRoleObject roleObject
int defineScopeSeparator(struct kindControlBlock *kcb, int kindIndex, int parentKindIndex, const char *separator)
Definition: kind.c:376
static void freeRoleControlBlock(struct roleControlBlock *rcb)
Definition: kind.c:149
int getKindIndexForLetter(struct kindControlBlock *kcb, char letter)
Definition: kind.c:272
void roleColprintTablePrint(struct colprintTable *table, bool noparser, bool withListHeader, bool machinable, FILE *fp)
Definition: kind.c:692
void kindColprintAddLanguageLines(struct colprintTable *table, struct kindControlBlock *kcb)
Definition: kind.c:548
kindDefinition * getKindForName(struct kindControlBlock *kcb, const char *name)
Definition: kind.c:257
int defineRole(struct kindControlBlock *kcb, int kindIndex, roleDefinition *def, freeRoleDefFunc freeRoleDef)
Definition: kind.c:201
#define KIND_GHOST_INDEX
Definition: kind.h:55
#define KIND_WILDCARD_INDEX
Definition: kind.h:63
#define KIND_WILDCARD_LETTER
Definition: kind.h:64
#define KIND_FILE_INDEX
Definition: kind.h:59
void(* freeKindDefFunc)(kindDefinition *)
Definition: kind_p.h:24
void(* freeRoleDefFunc)(roleDefinition *)
Definition: kind_p.h:25
void verbose(const char *const format,...)
Definition: options.c:655
langType getNamedLanguage(const char *const name, size_t len)
Definition: parse.c:406
const char * getLanguageName(const langType language)
Definition: parse.c:284
unsigned int countLanguageRoles(const langType language, int kindIndex)
Definition: parse.c:312
#define LANG_AUTO
Definition: parse.h:26
unsigned int ptrArrayCount(const ptrArray *const current)
Definition: ptrarray.c:80
void * ptrArrayItem(const ptrArray *const current, const unsigned int indx)
Definition: ptrarray.c:86
ptrArray * ptrArrayNew(ptrArrayDeleteFunc deleteFunc)
Definition: ptrarray.c:37
void ptrArrayDelete(ptrArray *const current)
Definition: ptrarray.c:111
unsigned int ptrArrayAdd(ptrArray *const current, void *ptr)
Definition: ptrarray.c:47
#define NULL
Definition: rbtree.h:150
void eFreeNoNullCheck(void *const ptr)
Definition: routines.c:258
char * eStrdup(const char *str)
Definition: routines.c:327
void eFree(void *const ptr)
Definition: routines.c:252
#define xMalloc(n, Type)
Definition: routines.h:23
@ FATAL
Definition: routines.h:37
#define xRealloc(p, n, Type)
Definition: routines.h:25
kindObject * kind
Definition: kind.c:49
scopeSeparator defaultScopeSeparator
Definition: kind.c:52
scopeSeparator defaultRootScopeSeparator
Definition: kind.c:53
unsigned int count
Definition: kind.c:50
langType owner
Definition: kind.c:51
unsigned int count
Definition: kind.c:37
roleObject * role
Definition: kind.c:36
char letter
Definition: kind.h:73
langType syncWith
Definition: kind.h:94
bool enabled
Definition: kind.h:72
kindDefinition * slave
Definition: kind.h:95
scopeSeparator * separators
Definition: kind.h:79
char * name
Definition: kind.h:74
kindDefinition * master
Definition: kind.h:96
roleDefinition * roles
Definition: kind.h:78
bool referenceOnly
Definition: kind.h:76
int nRoles
Definition: kind.h:77
unsigned int separatorCount
Definition: kind.h:80
char * description
Definition: kind.h:75
ptrArray * dynamicSeparators
Definition: kind.c:45
kindDefinition * def
Definition: kind.c:42
struct roleControlBlock * rcb
Definition: kind.c:44
freeKindDefFunc free
Definition: kind.c:43
langType id
Definition: parse.h:120
const char * defaultRootScopeSeparator
Definition: parse.h:114
const char * defaultScopeSeparator
Definition: parse.h:113
kindDefinition * kindTable
Definition: parse.h:76
unsigned int kindCount
Definition: parse.h:77
bool enabled
Definition: kind.h:24
char * description
Definition: kind.h:26
char * name
Definition: kind.h:25
roleDefinition * def
Definition: kind.c:31
freeRoleDefFunc free
Definition: kind.c:32
const char * separator
Definition: kind.h:68
int parentKindIndex
Definition: kind.h:67
int langType
Definition: types.h:13
vString * vStringNew(void)
Definition: vstring.c:70
void vStringDelete(vString *const string)
Definition: vstring.c:60
void vStringCatS(vString *const string, const char *const s)
Definition: vstring.c:146
#define vStringClear(string)
Definition: vstring.h:36
#define vStringValue(vs)
Definition: vstring.h:28
static void vStringPut(vString *const string, const int c)
Definition: vstring.h:101