2 * Copyright (c) 2009, Eric Forgeot
4 * Based on work by Jon Strait
6 * This source code is released for free distribution under the terms of the
7 * GNU General Public License.
9 * This module contains functions for generating tags for Abc files.
15 #include "general.h" /* must always come first */
28 static kindOption AbcKinds
[] = {
29 { TRUE
, 'm', "member", "sections" },
30 { TRUE
, 's', "struct", "header1"}
34 * FUNCTION DEFINITIONS
37 /* checks if str is all the same character */
38 /*static boolean issame(const char *str)
44 if (*str && *str != first)
51 static void makeAbcTag (const vString
* const name
, boolean name_before
)
54 initTagEntry (&e
, vStringValue(name
));
57 e
.lineNumber
--; /* we want the line before the underline chars */
58 e
.kindName
= AbcKinds
[0].name
;
59 e
.kind
= AbcKinds
[0].letter
;
64 /*static void makeAbcTag2 (const vString* const name, boolean name_before)
67 initTagEntry (&e, vStringValue(name));
71 e.kindName = "struct";
77 static void findAbcTags (void)
79 vString
*name
= vStringNew();
80 const unsigned char *line
;
82 while ((line
= fileReadLine()) != NULL
)
84 /*int name_len = vStringLength(name);*/
86 /* underlines must be the same length or more */
87 /*if (name_len > 0 && (line[0] == '=' || line[0] == '-') && issame((const char*) line))
89 makeAbcTag(name, TRUE);
91 /* if (line[1] == '%') {
93 vStringCatS(name, (const char *) line);
94 vStringTerminate(name);
95 makeAbcTag(name, FALSE);
98 /*vStringClear(name);*/
99 vStringCatS(name
, " / ");
100 vStringCatS(name
, (const char *) line
);
101 vStringTerminate(name
);
102 makeAbcTag(name
, FALSE
);
106 if (! isspace(*line
))
107 vStringCatS(name
, (const char*) line
);
108 vStringTerminate(name
);
111 vStringDelete (name
);
114 extern parserDefinition
* AbcParser (void)
116 static const char *const patterns
[] = { "*.abc", NULL
};
117 static const char *const extensions
[] = { "abc", NULL
};
118 parserDefinition
* const def
= parserNew ("Abc");
120 def
->kinds
= AbcKinds
;
121 def
->kindCount
= KIND_COUNT (AbcKinds
);
122 def
->patterns
= patterns
;
123 def
->extensions
= extensions
;
124 def
->parser
= findAbcTags
;