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 #ifndef CTAGS_MAIN_FIELD_PRIVATE_H 13 #define CTAGS_MAIN_FIELD_PRIVATE_H 14 15 /* 16 * INCLUDE FILES 17 */ 18 #include "general.h" 19 #include "colprint_p.h" 20 #include "field.h" 21 #include "optscript.h" 22 23 /* 24 * DATA DECLARATIONS 25 */ 26 27 28 /* 29 * FUNCTION PROTOTYPES 30 */ 31 32 extern fieldType getFieldTypeForOption (char letter); 33 34 /* 35 `getFieldTypeForName' is for looking for a field not owned by any parser, 36 37 `getFieldTypeForNameAndLanguage' can be used for getting all fields having 38 the same name; specify `LANG_AUTO' as `language' parameter to get the first 39 field having the name. With the returned fieldType, `nextSiblingField' gets 40 the next field having the same name. `nextSiblingField' returns `FIELD_UNKNOWN' 41 at the end of iteration. 42 43 Specifying `LANG_IGNORE' has the same effects as `LANG_AUTO'. However, 44 internally, each parser is not initialized. `LANG_IGNORE' is a bit faster. */ 45 extern fieldType getFieldTypeForName (const char *name); 46 extern fieldType getFieldTypeForNameAndLanguage (const char *fieldName, langType language); 47 extern bool enableField (fieldType type, bool state); 48 extern bool isCommonField (fieldType type); 49 extern int getFieldOwner (fieldType type); 50 extern const char* getFieldDescription (fieldType type); 51 extern const char* getFieldName (fieldType type); 52 extern unsigned char getFieldLetter (fieldType type); 53 extern unsigned int getFieldDataType (fieldType type); 54 extern bool isFieldValueAvailableAlways (fieldType type); 55 56 /* Whether the field specified with TYPE has a 57 method for rendering in the current format. */ 58 extern bool doesFieldHaveRenderer (fieldType type, bool noEscaping); 59 60 extern bool doesFieldHaveValue (fieldType type, const tagEntryInfo *tag); 61 62 extern const char* renderField (fieldType type, const tagEntryInfo *tag, int index); 63 extern const char* renderFieldNoEscaping (fieldType type, const tagEntryInfo *tag, int index); 64 extern bool doesFieldHaveTabOrNewlineChar (fieldType type, const tagEntryInfo *tag, int index); 65 66 extern void initFieldObjects (void); 67 extern int countFields (void); 68 69 /* language should be typed to langType. 70 Use int here to avoid circular dependency */ 71 extern int defineField (fieldDefinition *spec, langType language); 72 extern fieldType nextSiblingField (fieldType type); 73 74 /* --list-fields implementation. LANGUAGE must be initialized. */ 75 extern struct colprintTable * fieldColprintTableNew (void); 76 extern void fieldColprintAddCommonLines (struct colprintTable *table); 77 extern void fieldColprintAddLanguageLines (struct colprintTable *table, langType language); 78 extern void fieldColprintTablePrint (struct colprintTable *table, 79 bool withListHeader, bool machinable, FILE *fp); 80 81 /* tag is assumed that it is in the cork queue. */ 82 extern EsObject * getFieldValue (fieldType type, const tagEntryInfo *tag); 83 extern bool hasFieldGetter (fieldType type); 84 extern const char * getFieldGetterValueType (fieldType type); 85 extern EsObject * setFieldValue (fieldType type, tagEntryInfo *tag, const EsObject *val); 86 extern bool hasFieldSetter (fieldType type); 87 extern const char * getFieldSetterValueType (fieldType type); 88 extern bool hasFieldValueCheckerForSetter (fieldType type); 89 extern EsObject *checkFieldValueForSetter (fieldType type, const EsObject *val); 90 91 #endif /* CTAGS_MAIN_FIELD_PRIVATE_H */ 92