34#define FIELD_NULL_LETTER_CHAR '-'
35#define FIELD_NULL_LETTER_STRING "-"
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) \
97 .renderNoEscaping= RN, \
98 .doesContainAnyChar = DCAC, \
99 .isValueAvailable = A, \
103#define WITH_DEFUALT_VALUE(str) ((str)?(str):FIELD_NULL_LETTER_STRING)
127 "compact input line (used only in xref output)",
133 "Access (or export) of class members",
138 "File-restricted scoping",
143 "Inheritance information",
148 "Kind of tag in long-name form",
152 "Kind of tag in one-letter form",
156 "Language of input file containing tag",
161 "Implementation information",
166 "Line number of tag definition",
170 "Signature of routine (e.g. prototype or parameter list)",
176 "[tags output] scope (kind:name) of tag definition, [xref and json output] name of scope",
182 "Type and name of a variable or typedef",
187 "[tags output] prepend \"kind:\" to k/ (or K/) field output, [xref and json output] kind in long-name form",
200 "Marker (R or D) representing whether tag is definition or reference",
204 "[tags output] prepend \"scope:\" key to s/scope field output, [xref and json output] the same as s/ field",
212 "Extra tag type information",
222 "[tags output] no effect, [xref and json output] kind of scope in long-name form",
226 "end lines of various items",
277 char *nameWithPrefix;
286 nameWithPrefix [0] =
'\0';
288 strcat (nameWithPrefix, fobj->
def->
name);
327 static bool initialized =
false;
330 if (fieldName ==
NULL)
333 if (language ==
LANG_AUTO && (initialized ==
false))
338 else if (language !=
LANG_IGNORE && (initialized ==
false))
407 int unexpected_byte = 0;
409 if (isTagName && (!tag->
isPseudoTag) && (*s ==
' ' || *s ==
'!'))
414 unexpected_byte = *s;
427 while (*p > 0x1F && *p != 0x7F)
429 unexpected_byte = *p;
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",
438 verbose (
"Escape the character\n");
456 return strpbrk (tag->
name,
chars)?
true:
false;
485 return strpbrk (f,
chars)?
true:
false;
578 return rfn (tag, value, fobj->
buffer);
593 return strpbrk (value,
chars)?
true:
false;
605 if (doesContainAnyChar ==
NULL)
622 return (* doesContainAnyChar) (tag, value,
"\t\n");
629 bool lineStarted =
false;
635 for (p =
line, c = *p ; c !=
NEWLINE && c !=
'\0' ; c = *++p)
637 if (lineStarted || ! isspace (c))
646 while (next = *(p+1) , isspace (next) && next !=
NEWLINE)
698 char buf[32] = {[0] =
'\0'};
702 snprintf (buf,
sizeof(buf),
"%ld", ln);
716 int nRoleWritten = 0;
718 for (
int roleIndex = 0; roleIndex < roleCount; roleIndex++)
723 if (nRoleWritten > 0)
762 static char c[2] = { [1] =
'\0' };
806 static char c[2] = { [1] =
'\0' };
818 bool hasExtra =
false;
821 for (i = 0; i < c; i++)
920 for (i = 0; i <
sizeof (tag->
extra); i++)
956 if ((!state) && warnIfFixedField)
976 verbose (
"enable field \"%s\": %s\n",
978 (state?
"yes":
"no"));
980 verbose (
"enable field \"%s\"<%s>: %s\n",
983 (state?
"yes":
"no"));
1029 for (i = type; i > 0; i--)
1051 char *nameWithPrefix;
1056 for (i = 0; i < strlen (def->
name); i++)
1085 nameWithPrefix [0] =
'\0';
1087 strcat (nameWithPrefix, def->
name);
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
1108 "L:LANGUAGE",
"L:JSTYPE",
"L:FIXED",
"L:DESCRIPTION",
NULL);
1131 char typefields [] =
"---";
1133 unsigned int bmask, offset;
1135 for (bmask = 1, offset = 0;
1137 bmask <<= 1, offset++)
1169 if ((strcmp (a_fixed,
"yes") == 0)
1170 && (strcmp (b_fixed,
"yes") == 0))
1175 const char *ref_name;
1176 unsigned int a_index = ~0U;
1177 unsigned int b_index = ~0U;
1182 if (strcmp (a_name, ref_name) == 0)
1184 if (strcmp (b_name, ref_name) == 0)
1186 if ((a_index != ~0U) || (b_index != ~0U))
1190 if (a_index < b_index)
1192 else if (a_index == b_index)
1197 else if ((strcmp (a_fixed,
"yes") == 0)
1198 && (strcmp (b_fixed,
"yes") != 0))
1200 else if ((strcmp (a_fixed,
"yes") != 0)
1201 && (strcmp (b_fixed,
"yes") == 0))
1204 if (strcmp (a_parser,
RSV_NONE) == 0
1205 && strcmp (b_parser,
RSV_NONE) != 0)
1207 else if (strcmp (a_parser,
RSV_NONE) != 0
1208 && strcmp (b_parser,
RSV_NONE) == 0)
1210 else if (strcmp (a_parser,
RSV_NONE) != 0
1211 && strcmp (b_parser,
RSV_NONE) != 0)
1214 r = strcmp (a_parser, b_parser);
1221 return strcmp(a_name, b_name);
1228 return strcmp(a_letter, b_letter);
1233 bool withListHeader,
bool machinable, FILE *fp)
void colprintLineAppendColumnCString(struct colprintLine *line, const char *column)
void colprintTableSort(struct colprintTable *table, int(*compareFn)(struct colprintLine *, struct colprintLine *))
void colprintLineAppendColumnBool(struct colprintLine *line, bool column)
struct colprintLine * colprintTableGetNewLine(struct colprintTable *table)
struct colprintTable * colprintTableNew(const char *columnHeader,...)
void colprintLineAppendColumnChar(struct colprintLine *line, char column)
void colprintTablePrint(struct colprintTable *table, unsigned int startFrom, bool withHeader, bool machinable, FILE *fp)
const char * colprintLineGetColumn(struct colprintLine *line, unsigned int column)
#define AssertNotReached()
void getTagScopeInformation(tagEntryInfo *const tag, const char **kind, const char **name)
bool isTagExtraBitMarked(const tagEntryInfo *const tag, xtagType extra)
const tagField * getParserFieldForIndex(const tagEntryInfo *tag, int index)
char * readLineFromBypassForTag(vString *const vLine, const tagEntryInfo *const tag, long *const pSeekValue)
char * makePatternString(const tagEntryInfo *const tag)
#define ROLE_DEFINITION_NAME
const kindDefinition * getTagKind(const tagEntryInfo *const tag)
const char * getTagKindName(const tagEntryInfo *const tag)
const roleDefinition * getTagRole(const tagEntryInfo *const tag, int roleIndex)
char getTagKindLetter(const tagEntryInfo *const tag)
void error(const errorSelection selection, const char *const format,...)
unsigned int getFieldDataType(fieldType type)
static bool isAccessFieldAvailable(const tagEntryInfo *const tag)
static const char * renderFieldFile(const tagEntryInfo *const tag, const char *value, vString *b)
#define FIELD_COL_LANGUAGE
static bool doesContainAnyCharInInput(const tagEntryInfo *const tag, const char *value, const char *chars)
struct colprintTable * fieldColprintTableNew(void)
static int fieldColprintCompareLines(struct colprintLine *a, struct colprintLine *b)
static bool isFileFieldAvailable(const tagEntryInfo *const tag)
static const char * renderFieldInputNoEscape(const tagEntryInfo *const tag, const char *value, vString *b)
unsigned char getFieldLetter(fieldType type)
static bool isLanguageFieldAvailable(const tagEntryInfo *const tag)
bool doesFieldHaveTabOrNewlineChar(fieldType type, const tagEntryInfo *tag, int index)
static const char * renderFieldCommon(fieldType type, const tagEntryInfo *tag, int index, bool noEscaping)
static const char * renderFieldXpath(const tagEntryInfo *const tag, const char *value, vString *b)
static bool defaultDoesContainAnyChar(const tagEntryInfo *const tag, const char *value, const char *chars)
static fieldDefinition fieldDefinitionsFixed[]
static const char * renderFieldCompactInputLine(const tagEntryInfo *const tag, const char *value, vString *b)
static bool isTyperefFieldAvailable(const tagEntryInfo *const tag)
static const char * renderEscapedString(const char *s, const tagEntryInfo *const tag, vString *b)
const char * renderField(fieldType type, const tagEntryInfo *tag, int index)
static bool isXpathFieldAvailable(const tagEntryInfo *const tag)
bool doesFieldHaveRenderer(fieldType type, bool noEscaping)
static const char * renderFieldInput(const tagEntryInfo *const tag, const char *value, vString *b)
static void updateSiblingField(fieldType type, const char *name)
static const char * renderFieldTyperef(const tagEntryInfo *const tag, const char *value, vString *b)
static bool doesContainAnyCharInSignature(const tagEntryInfo *const tag, const char *value, const char *chars)
#define FIELD_NULL_LETTER_CHAR
static const char * renderEscapedName(const bool isTagName, const char *s, const tagEntryInfo *const tag, vString *b)
static const char * renderFieldEnd(const tagEntryInfo *const tag, const char *value, vString *b)
bool isFieldEnabled(fieldType type)
struct sFieldObject fieldObject
static fieldObject * fieldObjects
#define DEFINE_FIELD_FULL(L, N, V, H, A, DT, RE, RN, DCAC)
static void fieldColprintAddLine(struct colprintTable *table, int i)
#define FIELD_NULL_LETTER_STRING
static bool doesContainAnyCharInName(const tagEntryInfo *const tag, const char *value, const char *chars)
static const char * renderFieldRoles(const tagEntryInfo *const tag, const char *value, vString *b)
static const char * renderFieldImplementation(const tagEntryInfo *const tag, const char *value, vString *b)
static const char * renderFieldKindLetter(const tagEntryInfo *const tag, const char *value, vString *b)
static bool doesContainAnyCharInFieldScope(const tagEntryInfo *const tag, const char *value, const char *chars)
static const char * renderFieldSignatureNoEscape(const tagEntryInfo *const tag, const char *value, vString *b)
static bool isExtrasFieldAvailable(const tagEntryInfo *const tag)
void fieldColprintAddLanguageLines(struct colprintTable *table, langType language)
static const char * renderFieldLanguage(const tagEntryInfo *const tag, const char *value, vString *b)
static const char * renderFieldScopeNoEscape(const tagEntryInfo *const tag, const char *value, vString *b)
static fieldDefinition fieldDefinitionsExuberant[]
bool doesFieldHaveValue(fieldType type, const tagEntryInfo *tag)
bool enableField(fieldType type, bool state, bool warnIfFixedField)
static const char * renderFieldExtras(const tagEntryInfo *const tag, const char *value, vString *b)
static const char * defaultRenderer(const tagEntryInfo *const tag, const char *value, vString *buffer)
static bool isEndFieldAvailable(const tagEntryInfo *const tag)
fieldType getFieldTypeForOption(char letter)
const char * renderFieldNoEscaping(fieldType type, const tagEntryInfo *tag, int index)
static const char * renderFieldSignature(const tagEntryInfo *const tag, const char *value, vString *b)
static const char * renderFieldInherits(const tagEntryInfo *const tag, const char *value, vString *b)
fieldType getFieldTypeForName(const char *name)
static unsigned int fieldObjectUsed
const char * getFieldDescription(fieldType type)
static const char * renderAsIs(vString *b, const char *s)
fieldType nextSiblingField(fieldType type)
static const char * renderFieldLineNumber(const tagEntryInfo *const tag, const char *value, vString *b)
const char * getFieldName(fieldType type)
static const char * renderFieldNameNoEscape(const tagEntryInfo *const tag, const char *value, vString *b)
static fieldDefinition fieldDefinitionsUniversal[]
void fieldColprintAddCommonLines(struct colprintTable *table)
static const char * renderFieldPattern(const tagEntryInfo *const tag, const char *value, vString *b)
static bool isImplementationFieldAvailable(const tagEntryInfo *const tag)
static const char * renderFieldAccess(const tagEntryInfo *const tag, const char *value, vString *b)
static fieldObject * getFieldObject(fieldType type)
static bool isInheritsFieldAvailable(const tagEntryInfo *const tag)
int getFieldOwner(fieldType type)
static unsigned int fieldObjectAllocated
void fieldColprintTablePrint(struct colprintTable *table, bool withListHeader, bool machinable, FILE *fp)
static const char * renderFieldKindName(const tagEntryInfo *const tag, const char *value, vString *b)
void initFieldObjects(void)
fieldType getFieldTypeForNameAndLanguage(const char *fieldName, langType language)
static bool isSignatureFieldAvailable(const tagEntryInfo *const tag)
static const char * renderFieldRefMarker(const tagEntryInfo *const tag, const char *value, vString *b)
static const char * renderCompactInputLine(vString *b, const char *const line)
bool isCommonField(fieldType type)
#define DEFINE_FIELD(L, N, V, H, DT, RE)
static const char * renderFieldName(const tagEntryInfo *const tag, const char *value, vString *b)
static const char * renderFieldScope(const tagEntryInfo *const tag, const char *value, vString *b)
int defineField(fieldDefinition *def, langType language)
#define WITH_DEFUALT_VALUE(str)
static const char * renderFieldScopeKindName(const tagEntryInfo *const tag, const char *value, vString *b)
enum eFieldType fieldType
#define fieldDataTypeFalgs
const char *(* fieldRenderer)(const tagEntryInfo *const, const char *, vString *)
#define CTAGS_ATTR_UNUSED
const char * renderRole(const roleDefinition *const role, vString *b)
void verbose(const char *const format,...)
const char * getLanguageName(const langType language)
void initializeParser(langType lang)
bool isLanguageRoleEnabled(const langType language, int kindIndex, int roleIndex)
unsigned int countLanguageRoles(const langType language, int kindIndex)
void * eMalloc(const size_t size)
void eFreeIndirect(void **ptr)
void eFree(void *const ptr)
#define xRealloc(p, n, Type)
fieldRenderer renderNoEscaping
bool(* isValueAvailable)(const tagEntryInfo *const)
bool(* doesContainAnyChar)(const tagEntryInfo *const, const char *, const char *)
const char * nameWithPrefix
struct sTagEntryInfo::@3 extensionFields
const char * implementation
const char * inputFileName
unsigned long sourceLineNumberDifference
unsigned int usedParserFields
uint8_t extra[((XTAG_COUNT)/8)+1]
const char * sourceFileName
#define DEFAULT_TRASH_BOX(PTR, PROC)
vString * vStringNewOrClearWithAutoRelease(vString *const string)
void vStringCatSWithEscaping(vString *b, const char *s)
void vStringCatS(vString *const string, const char *const s)
#define vStringClear(string)
static void vStringPut(vString *const string, const int c)
bool writerDoesTreatFieldAsFixed(int fieldType)
const char * getXtagName(xtagType type)