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)  

field.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" /* must always come first */
14
15#include <errno.h>
16#include <stdlib.h>
17#include <string.h>
18
19#include "ctags.h"
20#include "debug.h"
21#include "entry.h"
22#include "entry_p.h"
23#include "field.h"
24#include "field_p.h"
25#include "kind.h"
26#include "options_p.h"
27#include "parse_p.h"
28#include "read.h"
29#include "routines.h"
30#include "trashbox.h"
31#include "writer_p.h"
32#include "xtag_p.h"
33
34#define FIELD_NULL_LETTER_CHAR '-'
35#define FIELD_NULL_LETTER_STRING "-"
36
37typedef struct sFieldObject {
40 const char* nameWithPrefix;
44
45static const char *renderFieldName (const tagEntryInfo *const tag, const char *value, vString* b);
46static const char *renderFieldNameNoEscape (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b);
47static const char *renderFieldInput (const tagEntryInfo *const tag, const char *value, vString* b);
48static const char *renderFieldInputNoEscape (const tagEntryInfo *const tag, const char *value, vString* b);
49static const char *renderFieldCompactInputLine (const tagEntryInfo *const tag, const char *value, vString* b);
50static const char *renderFieldSignature (const tagEntryInfo *const tag, const char *value, vString* b);
51static const char *renderFieldSignatureNoEscape (const tagEntryInfo *const tag, const char *value, vString* b);
52static const char *renderFieldScope (const tagEntryInfo *const tag, const char *value, vString* b);
53static const char *renderFieldScopeNoEscape (const tagEntryInfo *const tag, const char *value, vString* b);
54static const char *renderFieldTyperef (const tagEntryInfo *const tag, const char *value, vString* b);
55static const char *renderFieldInherits (const tagEntryInfo *const tag, const char *value, vString* b);
56static const char *renderFieldKindName (const tagEntryInfo *const tag, const char *value, vString* b);
57static const char *renderFieldLineNumber (const tagEntryInfo *const tag, const char *value, vString* b);
58static const char *renderFieldLanguage (const tagEntryInfo *const tag, const char *value, vString* b);
59static const char *renderFieldAccess (const tagEntryInfo *const tag, const char *value, vString* b);
60static const char *renderFieldKindLetter (const tagEntryInfo *const tag, const char *value, vString* b);
61static const char *renderFieldImplementation (const tagEntryInfo *const tag, const char *value, vString* b);
62static const char *renderFieldFile (const tagEntryInfo *const tag, const char *value, vString* b);
63static const char *renderFieldPattern (const tagEntryInfo *const tag, const char *value, vString* b);
64static const char *renderFieldRoles (const tagEntryInfo *const tag, const char *value, vString* b);
65static const char *renderFieldRefMarker (const tagEntryInfo *const tag, const char *value, vString* b);
66static const char *renderFieldExtras (const tagEntryInfo *const tag, const char *value, vString* b);
67static const char *renderFieldXpath (const tagEntryInfo *const tag, const char *value, vString* b);
68static const char *renderFieldScopeKindName(const tagEntryInfo *const tag, const char *value, vString* b);
69static const char *renderFieldEnd (const tagEntryInfo *const tag, const char *value, vString* b);
70
71static bool doesContainAnyCharInName (const tagEntryInfo *const tag, const char *value, const char *chars);
72static bool doesContainAnyCharInInput (const tagEntryInfo *const tag, const char*value, const char *chars);
73static bool doesContainAnyCharInFieldScope (const tagEntryInfo *const tag, const char *value, const char *chars);
74static bool doesContainAnyCharInSignature (const tagEntryInfo *const tag, const char *value, const char *chars);
75
76static bool isLanguageFieldAvailable (const tagEntryInfo *const tag);
77static bool isTyperefFieldAvailable (const tagEntryInfo *const tag);
78static bool isFileFieldAvailable (const tagEntryInfo *const tag);
79static bool isInheritsFieldAvailable (const tagEntryInfo *const tag);
80static bool isAccessFieldAvailable (const tagEntryInfo *const tag);
81static bool isImplementationFieldAvailable (const tagEntryInfo *const tag);
82static bool isSignatureFieldAvailable (const tagEntryInfo *const tag);
83static bool isExtrasFieldAvailable (const tagEntryInfo *const tag);
84static bool isXpathFieldAvailable (const tagEntryInfo *const tag);
85static bool isEndFieldAvailable (const tagEntryInfo *const tag);
86
87
88#define DEFINE_FIELD(L, N, V, H, DT, RE) \
89 DEFINE_FIELD_FULL (L, N, V, H, NULL, DT, RE, NULL, NULL)
90#define DEFINE_FIELD_FULL(L, N, V, H, A, DT, RE, RN, DCAC) \
91 { \
92 .letter = L, \
93 .name = N, \
94 .description = H, \
95 .enabled = V, \
96 .render = RE, \
97 .renderNoEscaping= RN, \
98 .doesContainAnyChar = DCAC, \
99 .isValueAvailable = A, \
100 .dataType = DT, \
101 }
102
103#define WITH_DEFUALT_VALUE(str) ((str)?(str):FIELD_NULL_LETTER_STRING)
104
106 /* FIXED FIELDS */
107 DEFINE_FIELD_FULL ('N', "name", true,
108 "tag name",
109 NULL,
113 DEFINE_FIELD_FULL ('F', "input", true,
114 "input file",
115 NULL,
119 DEFINE_FIELD ('P', "pattern", true,
120 "pattern",
123};
124
126 DEFINE_FIELD ('C', "compact", false,
127 "compact input line (used only in xref output)",
130
131 /* EXTENSION FIELDS */
132 DEFINE_FIELD_FULL ('a', "access", false,
133 "Access (or export) of class members",
137 DEFINE_FIELD_FULL ('f', "file", true,
138 "File-restricted scoping",
142 DEFINE_FIELD_FULL ('i', "inherits", false,
143 "Inheritance information",
147 DEFINE_FIELD ('K', NULL, false,
148 "Kind of tag in long-name form",
151 DEFINE_FIELD ('k', NULL, true,
152 "Kind of tag in one-letter form",
155 DEFINE_FIELD_FULL ('l', "language", false,
156 "Language of input file containing tag",
160 DEFINE_FIELD_FULL ('m', "implementation", false,
161 "Implementation information",
165 DEFINE_FIELD ('n', "line", false,
166 "Line number of tag definition",
169 DEFINE_FIELD_FULL ('S', "signature", false,
170 "Signature of routine (e.g. prototype or parameter list)",
175 DEFINE_FIELD_FULL ('s', NULL, true,
176 "[tags output] scope (kind:name) of tag definition, [xref and json output] name of scope",
177 NULL,
181 DEFINE_FIELD_FULL ('t', "typeref", true,
182 "Type and name of a variable or typedef",
186 DEFINE_FIELD ('z', "kind", false,
187 "[tags output] prepend \"kind:\" to k/ (or K/) field output, [xref and json output] kind in long-name form",
189 /* Following renderer is for handling --_xformat=%{kind};
190 and is not for tags output. */
192};
193
195 DEFINE_FIELD ('r', "roles", false,
196 "Roles",
199 DEFINE_FIELD ('R', NULL, false,
200 "Marker (R or D) representing whether tag is definition or reference",
203 DEFINE_FIELD_FULL ('Z', "scope", false,
204 "[tags output] prepend \"scope:\" key to s/scope field output, [xref and json output] the same as s/ field",
205 NULL,
207 /* Following renderer is for handling --_xformat=%{scope};
208 and is not for tags output. */
211 DEFINE_FIELD_FULL ('E', "extras", false,
212 "Extra tag type information",
216 DEFINE_FIELD_FULL ('x', "xpath", false,
217 "xpath for the tag",
221 DEFINE_FIELD ('p', "scopeKind", false,
222 "[tags output] no effect, [xref and json output] kind of scope in long-name form",
225 DEFINE_FIELD_FULL ('e', "end", false,
226 "end lines of various items",
230};
231
232
233static unsigned int fieldObjectUsed = 0;
234static unsigned int fieldObjectAllocated = 0;
236
237extern void initFieldObjects (void)
238{
239 unsigned int i;
240 fieldObject *fobj;
241
243
250
251 fieldObjectUsed = 0;
252
253 for (i = 0; i < ARRAY_SIZE (fieldDefinitionsFixed); i++)
254 {
255 fobj = fieldObjects + i + fieldObjectUsed;
256 fobj->def = fieldDefinitionsFixed + i;
257 fobj->buffer = NULL;
258 fobj->nameWithPrefix = fobj->def->name;
259 fobj->language = LANG_IGNORE;
260 fobj->sibling = FIELD_UNKNOWN;
261 }
263
264 for (i = 0; i < ARRAY_SIZE (fieldDefinitionsExuberant); i++)
265 {
266 fobj = fieldObjects + i + fieldObjectUsed;
268 fobj->buffer = NULL;
269 fobj->nameWithPrefix = fobj->def->name;
270 fobj->language = LANG_IGNORE;
271 fobj->sibling = FIELD_UNKNOWN;
272 }
274
275 for (i = 0; i < ARRAY_SIZE (fieldDefinitionsUniversal); i++)
276 {
277 char *nameWithPrefix;
278
279 fobj = fieldObjects + i + fieldObjectUsed;
280 fobj->def = fieldDefinitionsUniversal + i;
281 fobj->buffer = NULL;
282
283 if (fobj->def->name)
284 {
285 nameWithPrefix = eMalloc (sizeof CTAGS_FIELD_PREFIX + strlen (fobj->def->name) + 1);
286 nameWithPrefix [0] = '\0';
287 strcat (nameWithPrefix, CTAGS_FIELD_PREFIX);
288 strcat (nameWithPrefix, fobj->def->name);
289 fobj->nameWithPrefix = nameWithPrefix;
290 DEFAULT_TRASH_BOX(nameWithPrefix, eFree);
291 }
292 else
293 fobj->nameWithPrefix = NULL;
294 fobj->language = LANG_IGNORE;
295 fobj->sibling = FIELD_UNKNOWN;
296 }
298
300}
301
303{
304 Assert ((0 <= type) && ((unsigned int)type < fieldObjectUsed));
305 return fieldObjects + type;
306}
307
309{
310 unsigned int i;
311
312 for (i = 0; i < fieldObjectUsed; i++)
313 {
314 if (fieldObjects [i].def->letter == letter)
315 return i;
316 }
317 return FIELD_UNKNOWN;
318}
319
321{
323}
324
325extern fieldType getFieldTypeForNameAndLanguage (const char *fieldName, langType language)
326{
327 static bool initialized = false;
328 unsigned int i;
329
330 if (fieldName == NULL)
331 return FIELD_UNKNOWN;
332
333 if (language == LANG_AUTO && (initialized == false))
334 {
335 initialized = true;
337 }
338 else if (language != LANG_IGNORE && (initialized == false))
339 initializeParser (language);
340
341 for (i = 0; i < fieldObjectUsed; i++)
342 {
343 if (fieldObjects [i].def->name
344 && strcmp (fieldObjects [i].def->name, fieldName) == 0
345 && ((language == LANG_AUTO)
346 || (fieldObjects [i].language == language)))
347 return i;
348 }
349
350 return FIELD_UNKNOWN;
351}
352
353extern const char* getFieldDescription (fieldType type)
354{
355 fieldObject* fobj;
356
357 fobj = getFieldObject (type);
358 return fobj->def->description;
359}
360
361extern const char* getFieldName(fieldType type)
362{
363 fieldObject* fobj;
364
365 fobj = getFieldObject (type);
367 return fobj->nameWithPrefix;
368 else
369 return fobj->def->name;
370}
371
372extern unsigned char getFieldLetter (fieldType type)
373{
374 fieldObject* fobj = getFieldObject (type);
375
376 return fobj->def->letter == '\0'
378 : fobj->def->letter;
379}
380
381extern bool doesFieldHaveValue (fieldType type, const tagEntryInfo *tag)
382{
383 if (getFieldObject(type)->def->isValueAvailable)
384 return getFieldObject(type)->def->isValueAvailable(tag);
385 else
386 return true;
387}
388
389static const char *renderAsIs (vString* b CTAGS_ATTR_UNUSED, const char *s)
390{
391 return s;
392}
393
394static const char *renderEscapedString (const char *s,
395 const tagEntryInfo *const tag CTAGS_ATTR_UNUSED,
396 vString* b)
397{
399 return vStringValue (b);
400}
401
402static const char *renderEscapedName (const bool isTagName,
403 const char* s,
404 const tagEntryInfo *const tag,
405 vString* b)
406{
407 int unexpected_byte = 0;
408
409 if (isTagName && (!tag->isPseudoTag) && (*s == ' ' || *s == '!'))
410 {
411 /* Don't allow a leading space or exclamation mark as it conflicts with
412 * pseudo-tags when sorting. Anything with a lower byte value is
413 * escaped by renderEscapedString() already. */
414 unexpected_byte = *s;
415 switch (*s)
416 {
417 case ' ': vStringCatS (b, "\\x20"); s++; break;
418 case '!': vStringCatS (b, "\\x21"); s++; break;
419 default: AssertNotReached();
420 }
421 }
422 else
423 {
424 /* Find the first byte needing escaping for the warning message */
425 const char *p = s;
426
427 while (*p > 0x1F && *p != 0x7F)
428 p++;
429 unexpected_byte = *p;
430 }
431
432 if (unexpected_byte)
433 {
434 const kindDefinition *kdef = getTagKind (tag);
435 verbose ("Unexpected character %#04x included in a tagEntryInfo: %s\n", unexpected_byte, s);
436 verbose ("File: %s, Line: %lu, Lang: %s, Kind: %c\n",
437 tag->inputFileName, tag->lineNumber, getLanguageName(tag->langType), kdef->letter);
438 verbose ("Escape the character\n");
439 }
440
441 return renderEscapedString (s, tag, b);
442}
443
444static const char *renderFieldName (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
445{
446 return renderEscapedName (true, tag->name, tag, b);
447}
448
449static const char *renderFieldNameNoEscape (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
450{
451 return renderAsIs (b, tag->name);
452}
453
454static bool doesContainAnyCharInName (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, const char *chars)
455{
456 return strpbrk (tag->name, chars)? true: false;
457}
458
459static const char *renderFieldInput (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
460{
461 const char *f = tag->inputFileName;
462
464 f = tag->sourceFileName;
465 return renderEscapedString (f, tag, b);
466}
467
468static const char *renderFieldInputNoEscape (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
469{
470 const char *f = tag->inputFileName;
471
473 f = tag->sourceFileName;
474
475 return renderAsIs (b, f);
476}
477
478static bool doesContainAnyCharInInput (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, const char *chars)
479{
480 const char *f = tag->inputFileName;
481
483 f = tag->sourceFileName;
484
485 return strpbrk (f, chars)? true: false;
486}
487
488static const char *renderFieldSignature (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
489{
491 tag, b);
492}
493
494static const char *renderFieldSignatureNoEscape (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
495{
497}
498
499static bool doesContainAnyCharInSignature (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, const char *chars)
500{
501 return (tag->extensionFields.signature && strpbrk(tag->extensionFields.signature, chars))
502 ? true
503 : false;
504}
505
506static const char *renderFieldScope (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
507{
508 const char* scope;
509
511 return scope? renderEscapedName (false, scope, tag, b): NULL;
512}
513
514static const char *renderFieldScopeNoEscape (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
515{
516 const char* scope;
517
519 return scope? renderAsIs (b, scope): NULL;
520}
521
522static bool doesContainAnyCharInFieldScope (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, const char *chars)
523{
524 const char* scope;
525
527 return (scope && strpbrk (scope, chars));
528}
529
530
531static const char *renderFieldInherits (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
532{
534 tag, b);
535}
536
537static const char *renderFieldTyperef (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
538{
539 /* Return "-" instead of "-:-". */
540 if (tag->extensionFields.typeRef [0] == NULL
541 && tag->extensionFields.typeRef [1] == NULL)
543
545 vStringPut (b, ':');
546 return renderEscapedName (false, WITH_DEFUALT_VALUE (tag->extensionFields.typeRef [1]), tag, b);
547}
548
549
550static const char* renderFieldCommon (fieldType type,
551 const tagEntryInfo *tag,
552 int index,
553 bool noEscaping)
554{
555 fieldObject *fobj = fieldObjects + type;
556 const char *value;
557 fieldRenderer rfn;
558
559 Assert (tag);
560 Assert (index < 0 || ((unsigned int)index) < tag->usedParserFields);
561
562 if (index >= 0)
563 {
564 const tagField *f = getParserFieldForIndex (tag, index);
565
566 value = f->value;
567 }
568 else
569 value = NULL;
570
571 if (noEscaping)
572 rfn = fobj->def->renderNoEscaping;
573 else
574 rfn = fobj->def->render;
575 Assert (rfn);
576
578 return rfn (tag, value, fobj->buffer);
579}
580
581extern const char* renderField (fieldType type, const tagEntryInfo *tag, int index)
582{
583 return renderFieldCommon (type, tag, index, false);
584}
585
586extern const char* renderFieldNoEscaping (fieldType type, const tagEntryInfo *tag, int index)
587{
588 return renderFieldCommon (type, tag, index, true);
589}
590
591static bool defaultDoesContainAnyChar (const tagEntryInfo *const tag CTAGS_ATTR_UNUSED, const char* value, const char* chars)
592{
593 return strpbrk (value, chars)? true: false;
594}
595
597{
598 fieldObject *fobj = fieldObjects + type;
599 const char *value;
600 bool (* doesContainAnyChar) (const tagEntryInfo *const, const char*, const char*) = fobj->def->doesContainAnyChar;
601
602 Assert (tag);
603 Assert (index == NO_PARSER_FIELD || ((unsigned int)index) < tag->usedParserFields);
604
605 if (doesContainAnyChar == NULL)
606 {
607 if (index == NO_PARSER_FIELD)
608 return false;
609 else
610 doesContainAnyChar = defaultDoesContainAnyChar;
611 }
612
613 if (index >= 0)
614 {
615 const tagField *f = getParserFieldForIndex (tag, index);
616
617 value = f->value;
618 }
619 else
620 value = NULL;
621
622 return (* doesContainAnyChar) (tag, value, "\t\n");
623}
624
625/* Writes "line", stripping leading and duplicate white space.
626 */
627static const char* renderCompactInputLine (vString *b, const char *const line)
628{
629 bool lineStarted = false;
630 const char *p;
631 int c;
632
633 /* Write everything up to, but not including, the newline.
634 */
635 for (p = line, c = *p ; c != NEWLINE && c != '\0' ; c = *++p)
636 {
637 if (lineStarted || ! isspace (c)) /* ignore leading spaces */
638 {
639 lineStarted = true;
640 if (isspace (c))
641 {
642 int next;
643
644 /* Consume repeating white space.
645 */
646 while (next = *(p+1) , isspace (next) && next != NEWLINE)
647 ++p;
648 c = ' '; /* force space character for any white space */
649 }
650 if (c != CRETURN || *(p + 1) != NEWLINE)
651 vStringPut (b, c);
652 }
653 }
654 return vStringValue (b);
655}
656
657static const char *renderFieldKindName (const tagEntryInfo *const tag, const char *value CTAGS_ATTR_UNUSED, vString* b)
658{
659 const char* name = getTagKindName (tag);
660 return renderAsIs (b, name);
661}
662
663static const char *renderFieldCompactInputLine (const tagEntryInfo *const tag,
664 const char *value CTAGS_ATTR_UNUSED,
665 vString* b)
666{
667 const char *line;
668 static vString *tmp;
669
670 if (tag->isPseudoTag)
671 {
672 Assert (tag->pattern);
673 return tag->pattern;
674 }
675
677
678 line = readLineFromBypassForTag (tmp, tag, NULL);
679 if (line)
681 else
682 {
683 /* If no associated line for tag is found, we cannot prepare
684 * parameter to writeCompactInputLine(). In this case we
685 * use an empty string as LINE.
686 */
687 vStringClear (b);
688 }
689
690 return vStringValue (b);
691}
692
693static const char *renderFieldLineNumber (const tagEntryInfo *const tag,
694 const char *value CTAGS_ATTR_UNUSED,
695 vString* b)
696{
697 long ln = tag->lineNumber;
698 char buf[32] = {[0] = '\0'};
699
702 snprintf (buf, sizeof(buf), "%ld", ln);
703 vStringCatS (b, buf);
704 return vStringValue (b);
705}
706
707static const char *renderFieldRoles (const tagEntryInfo *const tag,
708 const char *value CTAGS_ATTR_UNUSED,
709 vString* b)
710{
712 const roleDefinition * role;
713 if (rbits)
714 {
715 int roleCount = countLanguageRoles (tag->langType, tag->kindIndex);
716 int nRoleWritten = 0;
717
718 for (int roleIndex = 0; roleIndex < roleCount; roleIndex++)
719 {
720 if (((rbits >> roleIndex) & (roleBitsType)1)
721 && isLanguageRoleEnabled (tag->langType, tag->kindIndex, roleIndex))
722 {
723 if (nRoleWritten > 0)
724 vStringPut(b, ',');
725
726 role = getTagRole(tag, roleIndex);
727 renderRole (role, b);
728 nRoleWritten++;
729 }
730 }
731 }
732 else
734 return vStringValue (b);
735}
736
737static const char *renderFieldLanguage (const tagEntryInfo *const tag,
738 const char *value CTAGS_ATTR_UNUSED,
739 vString* b)
740{
741 const char *l;
742
745 else
746 l = getLanguageName(tag->langType);
747
748 return renderAsIs (b, WITH_DEFUALT_VALUE(l));
749}
750
751static const char *renderFieldAccess (const tagEntryInfo *const tag,
752 const char *value CTAGS_ATTR_UNUSED,
753 vString* b)
754{
756}
757
758static const char *renderFieldKindLetter (const tagEntryInfo *const tag,
759 const char *value CTAGS_ATTR_UNUSED,
760 vString* b)
761{
762 static char c[2] = { [1] = '\0' };
763
764 c [0] = getTagKindLetter(tag);
765
766 return renderAsIs (b, c);
767}
768
769static const char *renderFieldImplementation (const tagEntryInfo *const tag,
770 const char *value CTAGS_ATTR_UNUSED,
771 vString* b)
772{
774}
775
776static const char *renderFieldFile (const tagEntryInfo *const tag,
777 const char *value CTAGS_ATTR_UNUSED,
778 vString* b)
779{
780 return renderAsIs (b, tag->isFileScope? "file": FIELD_NULL_LETTER_STRING);
781}
782
783static const char *renderFieldPattern (const tagEntryInfo *const tag,
784 const char *value CTAGS_ATTR_UNUSED,
785 vString* b)
786{
787 if (tag->isFileEntry)
788 return NULL;
789 else if (tag->pattern)
790 vStringCatS (b, tag->pattern);
791 else
792 {
793 char* tmp;
794
795 tmp = makePatternString (tag);
796 vStringCatS (b, tmp);
797 eFree (tmp);
798 }
799 return vStringValue (b);
800}
801
802static const char *renderFieldRefMarker (const tagEntryInfo *const tag,
803 const char *value CTAGS_ATTR_UNUSED,
804 vString* b)
805{
806 static char c[2] = { [1] = '\0' };
807
808 c [0] = (tag->extensionFields.roleBits)? 'R': 'D';
809
810 return renderAsIs (b, c);
811}
812
813static const char *renderFieldExtras (const tagEntryInfo *const tag,
814 const char *value CTAGS_ATTR_UNUSED,
815 vString* b)
816{
817 int i;
818 bool hasExtra = false;
819 int c = countXtags();
820
821 for (i = 0; i < c; i++)
822 {
823 const char *name = getXtagName (i);
824
825 if (!name)
826 continue;
827
828 if (isTagExtraBitMarked (tag, i))
829 {
830
831 if (hasExtra)
832 vStringPut (b, ',');
833 vStringCatS (b, name);
834 hasExtra = true;
835 }
836 }
837
838 if (hasExtra)
839 return vStringValue (b);
840 else
841 return NULL;
842}
843
844static const char *renderFieldXpath (const tagEntryInfo *const tag,
845 const char *value CTAGS_ATTR_UNUSED,
846 vString* b)
847{
848#ifdef HAVE_LIBXML
849 if (tag->extensionFields.xpath)
850 return renderEscapedString (tag->extensionFields.xpath,
851 tag, b);
852#endif
853 return NULL;
854}
855
856static const char *renderFieldScopeKindName(const tagEntryInfo *const tag,
857 const char *value CTAGS_ATTR_UNUSED,
858 vString* b)
859{
860 const char* kind;
861
862 getTagScopeInformation ((tagEntryInfo *const)tag, &kind, NULL);
863 return kind? renderAsIs (b, kind): NULL;
864}
865
866static const char *renderFieldEnd (const tagEntryInfo *const tag,
867 const char *value CTAGS_ATTR_UNUSED,
868 vString* b)
869{
870 static char buf[21];
871
872 if (tag->extensionFields.endLine != 0)
873 {
874 sprintf (buf, "%lu", tag->extensionFields.endLine);
875 return renderAsIs (b, buf);
876 }
877 else
878 return NULL;
879}
880
881static bool isLanguageFieldAvailable (const tagEntryInfo *const tag)
882{
883 return (tag->langType == LANG_IGNORE)? false: true;
884}
885
886static bool isTyperefFieldAvailable (const tagEntryInfo *const tag)
887{
888 return (tag->extensionFields.typeRef [0] != NULL
889 && tag->extensionFields.typeRef [1] != NULL)? true: false;
890}
891
892static bool isFileFieldAvailable (const tagEntryInfo *const tag)
893{
894 return tag->isFileScope? true: false;
895}
896
897static bool isInheritsFieldAvailable (const tagEntryInfo *const tag)
898{
899 return (tag->extensionFields.inheritance != NULL)? true: false;
900}
901
902static bool isAccessFieldAvailable (const tagEntryInfo *const tag)
903{
904 return (tag->extensionFields.access != NULL)? true: false;
905}
906
907static bool isImplementationFieldAvailable (const tagEntryInfo *const tag)
908{
909 return (tag->extensionFields.implementation != NULL)? true: false;
910}
911
912static bool isSignatureFieldAvailable (const tagEntryInfo *const tag)
913{
914 return (tag->extensionFields.signature != NULL)? true: false;
915}
916
917static bool isExtrasFieldAvailable (const tagEntryInfo *const tag)
918{
919 unsigned int i;
920 for (i = 0; i < sizeof (tag->extra); i++)
921 {
922 if (tag->extra [i])
923 return true;
924 else if (tag->extraDynamic)
925 return true;
926 }
927
928 return false;
929}
930
931static bool isXpathFieldAvailable (const tagEntryInfo *const tag)
932{
933#ifdef HAVE_LIBXML
934 return (tag->extensionFields.xpath != NULL)? true: false;
935#else
936 return false;
937#endif
938}
939
940static bool isEndFieldAvailable (const tagEntryInfo *const tag)
941{
942 return (tag->extensionFields.endLine != 0)? true: false;
943}
944
945extern bool isFieldEnabled (fieldType type)
946{
947 return getFieldObject(type)->def->enabled;
948}
949
950extern bool enableField (fieldType type, bool state, bool warnIfFixedField)
951{
952 fieldDefinition *def = getFieldObject(type)->def;
953 bool old = def->enabled;
955 {
956 if ((!state) && warnIfFixedField)
957 {
958 if (def->name && def->letter != NUL_FIELD_LETTER)
959 error(WARNING, "Cannot disable fixed field: '%c'{%s}",
960 def->letter, def->name);
961 else if (def->name)
962 error(WARNING, "Cannot disable fixed field: {%s}",
963 def->name);
964 else if (def->letter != NUL_FIELD_LETTER)
965 error(WARNING, "Cannot disable fixed field: '%c'",
966 getFieldObject(type)->def->letter);
967 else
969 }
970 }
971 else
972 {
973 getFieldObject(type)->def->enabled = state;
974
975 if (isCommonField (type))
976 verbose ("enable field \"%s\": %s\n",
977 getFieldObject(type)->def->name,
978 (state? "yes": "no"));
979 else
980 verbose ("enable field \"%s\"<%s>: %s\n",
981 getFieldObject(type)->def->name,
983 (state? "yes": "no"));
984 }
985 return old;
986}
987
988extern bool isCommonField (fieldType type)
989{
990 return (FIELD_BUILTIN_LAST < type)? false: true;
991}
992
993extern int getFieldOwner (fieldType type)
994{
995 return getFieldObject(type)->language;
996}
997
998extern unsigned int getFieldDataType (fieldType type)
999{
1000 return getFieldObject(type)->def->dataType;
1001}
1002
1003extern bool doesFieldHaveRenderer (fieldType type, bool noEscaping)
1004{
1005 if (noEscaping)
1006 return getFieldObject(type)->def->renderNoEscaping? true: false;
1007 else
1008 return getFieldObject(type)->def->render? true: false;
1009}
1010
1011extern int countFields (void)
1012{
1013 return fieldObjectUsed;
1014}
1015
1017{
1018 fieldObject *fobj;
1019
1020 fobj = fieldObjects + type;
1021 return fobj->sibling;
1022}
1023
1024static void updateSiblingField (fieldType type, const char* name)
1025{
1026 int i;
1027 fieldObject *fobj;
1028
1029 for (i = type; i > 0; i--)
1030 {
1031 fobj = fieldObjects + i - 1;
1032 if (fobj->def->name && (strcmp (fobj->def->name, name) == 0))
1033 {
1034 Assert (fobj->sibling == FIELD_UNKNOWN);
1035 fobj->sibling = type;
1036 break;
1037 }
1038 }
1039}
1040
1041static const char* defaultRenderer (const tagEntryInfo *const tag CTAGS_ATTR_UNUSED,
1042 const char *value,
1043 vString * buffer CTAGS_ATTR_UNUSED)
1044{
1045 return renderEscapedString (value, tag, buffer);
1046}
1047
1048extern int defineField (fieldDefinition *def, langType language)
1049{
1050 fieldObject *fobj;
1051 char *nameWithPrefix;
1052 size_t i;
1053
1054 Assert (def);
1055 Assert (def->name);
1056 for (i = 0; i < strlen (def->name); i++)
1057 {
1058 Assert ( isalpha (def->name [i]) );
1059 }
1060 def->letter = NUL_FIELD_LETTER;
1061
1063 {
1066 }
1067 fobj = fieldObjects + (fieldObjectUsed);
1068 def->ftype = fieldObjectUsed++;
1069
1070 if (def->render == NULL)
1071 {
1072 def->render = defaultRenderer;
1073 def->renderNoEscaping = NULL;
1074 def->doesContainAnyChar = NULL;
1075 }
1076
1077 if (! def->dataType)
1079
1080 fobj->def = def;
1081
1082 fobj->buffer = NULL;
1083
1084 nameWithPrefix = eMalloc (sizeof CTAGS_FIELD_PREFIX + strlen (def->name) + 1);
1085 nameWithPrefix [0] = '\0';
1086 strcat (nameWithPrefix, CTAGS_FIELD_PREFIX);
1087 strcat (nameWithPrefix, def->name);
1088 fobj->nameWithPrefix = nameWithPrefix;
1089 DEFAULT_TRASH_BOX(nameWithPrefix, eFree);
1090
1091 fobj->language = language;
1092 fobj->sibling = FIELD_UNKNOWN;
1093
1094 updateSiblingField (def->ftype, def->name);
1095 return def->ftype;
1096}
1097
1098#define FIELD_COL_LETTER 0
1099#define FIELD_COL_NAME 1
1100#define FIELD_COL_ENABLED 2
1101#define FIELD_COL_LANGUAGE 3
1102#define FIELD_COL_JSTYPE 4
1103#define FIELD_COL_FIXED 5
1104#define FIELD_COL_DESCRIPTION 6
1106{
1107 return colprintTableNew ("L:LETTER", "L:NAME", "L:ENABLED",
1108 "L:LANGUAGE", "L:JSTYPE", "L:FIXED", "L:DESCRIPTION", NULL);
1109}
1110
1111static void fieldColprintAddLine (struct colprintTable *table, int i)
1112{
1113 fieldObject *fobj = getFieldObject(i);
1114 fieldDefinition *fdef = fobj->def;
1115
1116 struct colprintLine *line = colprintTableGetNewLine(table);
1117
1119 (fdef->letter == NUL_FIELD_LETTER)
1121 : fdef->letter);
1122
1123 const char *name = getFieldName (i);
1127 fobj->language == LANG_IGNORE
1128 ? RSV_NONE
1129 : getLanguageName (fobj->language));
1130
1131 char typefields [] = "---";
1132 {
1133 unsigned int bmask, offset;
1134 unsigned int type = getFieldDataType(i);
1135 for (bmask = 1, offset = 0;
1136 bmask < FIELDTYPE_END_MARKER;
1137 bmask <<= 1, offset++)
1138 if (type & bmask)
1139 typefields[offset] = fieldDataTypeFalgs[offset];
1140 }
1144}
1145
1147{
1148 for (int i = 0; i <= FIELD_BUILTIN_LAST; i++)
1149 fieldColprintAddLine(table, i);
1150}
1151
1152extern void fieldColprintAddLanguageLines (struct colprintTable *table, langType language)
1153{
1154 for (unsigned int i = FIELD_BUILTIN_LAST + 1; i < fieldObjectUsed; i++)
1155 {
1156 fieldObject *fobj = getFieldObject(i);
1157 if (fobj->language == language)
1158 fieldColprintAddLine (table, i);
1159 }
1160}
1161
1162static int fieldColprintCompareLines (struct colprintLine *a , struct colprintLine *b)
1163{
1164 const char *a_fixed = colprintLineGetColumn (a, FIELD_COL_FIXED);
1165 const char *b_fixed = colprintLineGetColumn (b, FIELD_COL_FIXED);
1166 const char *a_parser = colprintLineGetColumn (a, FIELD_COL_LANGUAGE);
1167 const char *b_parser = colprintLineGetColumn (b, FIELD_COL_LANGUAGE);
1168
1169 if ((strcmp (a_fixed, "yes") == 0)
1170 && (strcmp (b_fixed, "yes") == 0))
1171 {
1172 /* name, input, pattern, compact */
1173 const char *a_name = colprintLineGetColumn (a, FIELD_COL_NAME);
1174 const char *b_name = colprintLineGetColumn (b, FIELD_COL_NAME);
1175 const char *ref_name;
1176 unsigned int a_index = ~0U;
1177 unsigned int b_index = ~0U;
1178
1179 for (unsigned int i = 0; i < ARRAY_SIZE(fieldDefinitionsFixed); i++)
1180 {
1181 ref_name = fieldDefinitionsFixed [i].name;
1182 if (strcmp (a_name, ref_name) == 0)
1183 a_index = i;
1184 if (strcmp (b_name, ref_name) == 0)
1185 b_index = i;
1186 if ((a_index != ~0U) || (b_index != ~0U))
1187 break;
1188 }
1189
1190 if (a_index < b_index)
1191 return -1;
1192 else if (a_index == b_index)
1193 return 0; /* ??? */
1194 else
1195 return 1;
1196 }
1197 else if ((strcmp (a_fixed, "yes") == 0)
1198 && (strcmp (b_fixed, "yes") != 0))
1199 return -1;
1200 else if ((strcmp (a_fixed, "yes") != 0)
1201 && (strcmp (b_fixed, "yes") == 0))
1202 return 1;
1203
1204 if (strcmp (a_parser, RSV_NONE) == 0
1205 && strcmp (b_parser, RSV_NONE) != 0)
1206 return -1;
1207 else if (strcmp (a_parser, RSV_NONE) != 0
1208 && strcmp (b_parser, RSV_NONE) == 0)
1209 return 1;
1210 else if (strcmp (a_parser, RSV_NONE) != 0
1211 && strcmp (b_parser, RSV_NONE) != 0)
1212 {
1213 int r;
1214 r = strcmp (a_parser, b_parser);
1215 if (r != 0)
1216 return r;
1217
1218 const char *a_name = colprintLineGetColumn (a, FIELD_COL_NAME);
1219 const char *b_name = colprintLineGetColumn (b, FIELD_COL_NAME);
1220
1221 return strcmp(a_name, b_name);
1222 }
1223 else
1224 {
1225 const char *a_letter = colprintLineGetColumn (a, FIELD_COL_LETTER);
1226 const char *b_letter = colprintLineGetColumn (b, FIELD_COL_LETTER);
1227
1228 return strcmp(a_letter, b_letter);
1229 }
1230}
1231
1232extern void fieldColprintTablePrint (struct colprintTable *table,
1233 bool withListHeader, bool machinable, FILE *fp)
1234{
1236 colprintTablePrint (table, 0, withListHeader, machinable, fp);
1237}
gint index
Definition: build.c:2680
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 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 CTAGS_FIELD_PREFIX
Definition: ctags.h:31
#define RSV_NONE
Definition: ctags.h:39
#define Assert(c)
Definition: debug.h:47
#define AssertNotReached()
Definition: debug.h:48
const gchar * name
Definition: document.c:3219
void getTagScopeInformation(tagEntryInfo *const tag, const char **kind, const char **name)
Definition: entry.c:803
bool isTagExtraBitMarked(const tagEntryInfo *const tag, xtagType extra)
Definition: entry.c:1904
const tagField * getParserFieldForIndex(const tagEntryInfo *tag, int index)
Definition: entry.c:996
char * readLineFromBypassForTag(vString *const vLine, const tagEntryInfo *const tag, long *const pSeekValue)
Definition: entry.c:724
char * makePatternString(const tagEntryInfo *const tag)
Definition: entry.c:921
#define ROLE_DEFINITION_NAME
Definition: entry.h:91
uint64_t roleBitsType
Definition: entry.h:39
#define NO_PARSER_FIELD
Definition: entry.h:108
const kindDefinition * getTagKind(const tagEntryInfo *const tag)
Definition: entry_private.c:15
const char * getTagKindName(const tagEntryInfo *const tag)
Definition: entry_private.c:26
const roleDefinition * getTagRole(const tagEntryInfo *const tag, int roleIndex)
Definition: entry_private.c:32
char getTagKindLetter(const tagEntryInfo *const tag)
Definition: entry_private.c:20
void error(const errorSelection selection, const char *const format,...)
Definition: error.c:53
unsigned int getFieldDataType(fieldType type)
Definition: field.c:998
static bool isAccessFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:902
static const char * renderFieldFile(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:776
#define FIELD_COL_LANGUAGE
Definition: field.c:1101
static bool doesContainAnyCharInInput(const tagEntryInfo *const tag, const char *value, const char *chars)
Definition: field.c:478
struct colprintTable * fieldColprintTableNew(void)
Definition: field.c:1105
static int fieldColprintCompareLines(struct colprintLine *a, struct colprintLine *b)
Definition: field.c:1162
static bool isFileFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:892
static const char * renderFieldInputNoEscape(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:468
unsigned char getFieldLetter(fieldType type)
Definition: field.c:372
static bool isLanguageFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:881
#define FIELD_COL_LETTER
Definition: field.c:1098
bool doesFieldHaveTabOrNewlineChar(fieldType type, const tagEntryInfo *tag, int index)
Definition: field.c:596
static const char * renderFieldCommon(fieldType type, const tagEntryInfo *tag, int index, bool noEscaping)
Definition: field.c:550
static const char * renderFieldXpath(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:844
static bool defaultDoesContainAnyChar(const tagEntryInfo *const tag, const char *value, const char *chars)
Definition: field.c:591
static fieldDefinition fieldDefinitionsFixed[]
Definition: field.c:105
#define FIELD_COL_NAME
Definition: field.c:1099
static const char * renderFieldCompactInputLine(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:663
static bool isTyperefFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:886
static const char * renderEscapedString(const char *s, const tagEntryInfo *const tag, vString *b)
Definition: field.c:394
const char * renderField(fieldType type, const tagEntryInfo *tag, int index)
Definition: field.c:581
static bool isXpathFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:931
bool doesFieldHaveRenderer(fieldType type, bool noEscaping)
Definition: field.c:1003
static const char * renderFieldInput(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:459
static void updateSiblingField(fieldType type, const char *name)
Definition: field.c:1024
static const char * renderFieldTyperef(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:537
static bool doesContainAnyCharInSignature(const tagEntryInfo *const tag, const char *value, const char *chars)
Definition: field.c:499
#define FIELD_NULL_LETTER_CHAR
Definition: field.c:34
static const char * renderEscapedName(const bool isTagName, const char *s, const tagEntryInfo *const tag, vString *b)
Definition: field.c:402
static const char * renderFieldEnd(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:866
bool isFieldEnabled(fieldType type)
Definition: field.c:945
int countFields(void)
Definition: field.c:1011
struct sFieldObject fieldObject
static fieldObject * fieldObjects
Definition: field.c:235
#define DEFINE_FIELD_FULL(L, N, V, H, A, DT, RE, RN, DCAC)
Definition: field.c:90
static void fieldColprintAddLine(struct colprintTable *table, int i)
Definition: field.c:1111
#define FIELD_NULL_LETTER_STRING
Definition: field.c:35
static bool doesContainAnyCharInName(const tagEntryInfo *const tag, const char *value, const char *chars)
Definition: field.c:454
static const char * renderFieldRoles(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:707
static const char * renderFieldImplementation(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:769
static const char * renderFieldKindLetter(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:758
static bool doesContainAnyCharInFieldScope(const tagEntryInfo *const tag, const char *value, const char *chars)
Definition: field.c:522
static const char * renderFieldSignatureNoEscape(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:494
static bool isExtrasFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:917
void fieldColprintAddLanguageLines(struct colprintTable *table, langType language)
Definition: field.c:1152
static const char * renderFieldLanguage(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:737
#define FIELD_COL_FIXED
Definition: field.c:1103
static const char * renderFieldScopeNoEscape(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:514
static fieldDefinition fieldDefinitionsExuberant[]
Definition: field.c:125
bool doesFieldHaveValue(fieldType type, const tagEntryInfo *tag)
Definition: field.c:381
bool enableField(fieldType type, bool state, bool warnIfFixedField)
Definition: field.c:950
static const char * renderFieldExtras(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:813
static const char * defaultRenderer(const tagEntryInfo *const tag, const char *value, vString *buffer)
Definition: field.c:1041
static bool isEndFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:940
fieldType getFieldTypeForOption(char letter)
Definition: field.c:308
const char * renderFieldNoEscaping(fieldType type, const tagEntryInfo *tag, int index)
Definition: field.c:586
static const char * renderFieldSignature(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:488
static const char * renderFieldInherits(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:531
fieldType getFieldTypeForName(const char *name)
Definition: field.c:320
static unsigned int fieldObjectUsed
Definition: field.c:233
const char * getFieldDescription(fieldType type)
Definition: field.c:353
static const char * renderAsIs(vString *b, const char *s)
Definition: field.c:389
fieldType nextSiblingField(fieldType type)
Definition: field.c:1016
static const char * renderFieldLineNumber(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:693
const char * getFieldName(fieldType type)
Definition: field.c:361
static const char * renderFieldNameNoEscape(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:449
static fieldDefinition fieldDefinitionsUniversal[]
Definition: field.c:194
void fieldColprintAddCommonLines(struct colprintTable *table)
Definition: field.c:1146
static const char * renderFieldPattern(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:783
static bool isImplementationFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:907
static const char * renderFieldAccess(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:751
static fieldObject * getFieldObject(fieldType type)
Definition: field.c:302
static bool isInheritsFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:897
int getFieldOwner(fieldType type)
Definition: field.c:993
static unsigned int fieldObjectAllocated
Definition: field.c:234
void fieldColprintTablePrint(struct colprintTable *table, bool withListHeader, bool machinable, FILE *fp)
Definition: field.c:1232
static const char * renderFieldKindName(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:657
void initFieldObjects(void)
Definition: field.c:237
fieldType getFieldTypeForNameAndLanguage(const char *fieldName, langType language)
Definition: field.c:325
static bool isSignatureFieldAvailable(const tagEntryInfo *const tag)
Definition: field.c:912
static const char * renderFieldRefMarker(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:802
static const char * renderCompactInputLine(vString *b, const char *const line)
Definition: field.c:627
bool isCommonField(fieldType type)
Definition: field.c:988
#define DEFINE_FIELD(L, N, V, H, DT, RE)
Definition: field.c:88
static const char * renderFieldName(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:444
static const char * renderFieldScope(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:506
int defineField(fieldDefinition *def, langType language)
Definition: field.c:1048
#define WITH_DEFUALT_VALUE(str)
Definition: field.c:103
static const char * renderFieldScopeKindName(const tagEntryInfo *const tag, const char *value, vString *b)
Definition: field.c:856
enum eFieldType fieldType
#define fieldDataTypeFalgs
Definition: field.h:63
@ FIELDTYPE_STRING
Definition: field.h:65
@ FIELDTYPE_BOOL
Definition: field.h:67
@ FIELDTYPE_END_MARKER
Definition: field.h:70
@ FIELDTYPE_INTEGER
Definition: field.h:66
const char *(* fieldRenderer)(const tagEntryInfo *const, const char *, vString *)
Definition: field.h:73
#define NUL_FIELD_LETTER
Definition: field.h:81
@ FIELD_UNKNOWN
Definition: field.h:29
@ FIELD_BUILTIN_LAST
Definition: field.h:60
#define CTAGS_ATTR_UNUSED
Definition: gcc-attr.h:22
vString * line
Definition: geany_cobol.c:133
static vString * scope
Definition: geany_go.c:78
const gchar * chars[][2]
Definition: htmlchars.c:72
const char * renderRole(const roleDefinition *const role, vString *b)
Definition: kind.c:56
void verbose(const char *const format,...)
Definition: options.c:655
optionValues Option
Definition: options.c:137
const char * getLanguageName(const langType language)
Definition: parse.c:284
void initializeParser(langType lang)
Definition: parse.c:1850
bool isLanguageRoleEnabled(const langType language, int kindIndex, int roleIndex)
Definition: parse.c:2229
unsigned int countLanguageRoles(const langType language, int kindIndex)
Definition: parse.c:312
#define LANG_IGNORE
Definition: parse.h:27
#define LANG_AUTO
Definition: parse.h:26
#define NULL
Definition: rbtree.h:150
@ NEWLINE
Definition: read.h:35
@ CRETURN
Definition: read.h:36
void * eMalloc(const size_t size)
Definition: routines.c:218
void eFreeIndirect(void **ptr)
Definition: routines.c:263
void eFree(void *const ptr)
Definition: routines.c:252
#define xMalloc(n, Type)
Definition: routines.h:23
@ WARNING
Definition: routines.h:37
#define ARRAY_SIZE(X)
Definition: routines.h:27
#define xRealloc(p, n, Type)
Definition: routines.h:25
fieldRenderer renderNoEscaping
Definition: field.h:88
unsigned int ftype
Definition: field.h:95
const char * name
Definition: field.h:83
bool enabled
Definition: field.h:85
const char * description
Definition: field.h:84
bool(* isValueAvailable)(const tagEntryInfo *const)
Definition: field.h:91
bool(* doesContainAnyChar)(const tagEntryInfo *const, const char *, const char *)
Definition: field.h:89
unsigned char letter
Definition: field.h:82
fieldDataType dataType
Definition: field.h:93
fieldRenderer render
Definition: field.h:87
fieldType sibling
Definition: field.c:42
const char * nameWithPrefix
Definition: field.c:40
langType language
Definition: field.c:41
vString * buffer
Definition: field.c:39
fieldDefinition * def
Definition: field.c:38
char letter
Definition: kind.h:73
bool lineDirectives
Definition: options_p.h:113
bool putFieldPrefix
Definition: options_p.h:119
struct sTagEntryInfo::@3 extensionFields
roleBitsType roleBits
Definition: entry.h:93
const char * implementation
Definition: entry.h:71
const char * name
Definition: entry.h:63
unsigned int isFileScope
Definition: entry.h:45
langType sourceLangType
Definition: entry.h:114
const char * inputFileName
Definition: entry.h:62
const char * access
Definition: entry.h:69
uint8_t * extraDynamic
Definition: entry.h:66
unsigned long lineNumber
Definition: entry.h:56
int kindIndex
Definition: entry.h:64
langType langType
Definition: entry.h:61
unsigned int isPseudoTag
Definition: entry.h:53
unsigned long sourceLineNumberDifference
Definition: entry.h:116
unsigned int usedParserFields
Definition: entry.h:106
const char * typeRef[2]
Definition: entry.h:88
const char * pattern
Definition: entry.h:57
unsigned long endLine
Definition: entry.h:98
uint8_t extra[((XTAG_COUNT)/8)+1]
Definition: entry.h:65
const char * sourceFileName
Definition: entry.h:115
const char * inheritance
Definition: entry.h:72
const char * signature
Definition: entry.h:85
unsigned int isFileEntry
Definition: entry.h:46
const char * value
Definition: entry.h:35
#define DEFAULT_TRASH_BOX(PTR, PROC)
Definition: trashbox.h:34
int langType
Definition: types.h:13
vString * vStringNewOrClearWithAutoRelease(vString *const string)
Definition: vstring.c:379
void vStringCatSWithEscaping(vString *b, const char *s)
Definition: vstring.c:304
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
bool writerDoesTreatFieldAsFixed(int fieldType)
Definition: writer.c:120
const char * getXtagName(xtagType type)
Definition: xtag.c:290
int countXtags(void)
Definition: xtag.c:327