Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[40ab39]: tagmanager / abc.c Maximize Restore History

Download this file

abc.c    128 lines (106 with data), 2.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* Copyright (c) 2009, Eric Forgeot
*
* Based on work by Jon Strait
*
* This source code is released for free distribution under the terms of the
* GNU General Public License.
*
* This module contains functions for generating tags for Abc files.
*/
/*
* INCLUDE FILES
*/
#include "general.h" /* must always come first */
#include <ctype.h>
#include <string.h>
#include "parse.h"
#include "read.h"
#include "vstring.h"
/*
* DATA DEFINITIONS
*/
static kindOption AbcKinds[] = {
{ TRUE, 'm', "member", "sections" },
{ TRUE, 's', "struct", "header1"}
};
/*
* FUNCTION DEFINITIONS
*/
/* checks if str is all the same character */
/*static boolean issame(const char *str)
{
char first = *str;
while (*(++str))
{
if (*str && *str != first)
return FALSE;
}
return TRUE;
}*/
static void makeAbcTag (const vString* const name, boolean name_before)
{
tagEntryInfo e;
initTagEntry (&e, vStringValue(name));
if (name_before)
e.lineNumber--; /* we want the line before the underline chars */
e.kindName = AbcKinds[0].name;
e.kind = AbcKinds[0].letter;
makeTagEntry(&e);
}
/*static void makeAbcTag2 (const vString* const name, boolean name_before)
{
tagEntryInfo e;
initTagEntry (&e, vStringValue(name));
if (name_before)
e.lineNumber--;
e.kindName = "struct";
e.kind = 's';
makeTagEntry(&e);
}*/
static void findAbcTags (void)
{
vString *name = vStringNew();
const unsigned char *line;
while ((line = fileReadLine()) != NULL)
{
/*int name_len = vStringLength(name);*/
/* underlines must be the same length or more */
/*if (name_len > 0 && (line[0] == '=' || line[0] == '-') && issame((const char*) line))
{
makeAbcTag(name, TRUE);
}*/
/* if (line[1] == '%') {
vStringClear(name);
vStringCatS(name, (const char *) line);
vStringTerminate(name);
makeAbcTag(name, FALSE);
}*/
if (line[0] == 'T') {
/*vStringClear(name);*/
vStringCatS(name, " / ");
vStringCatS(name, (const char *) line);
vStringTerminate(name);
makeAbcTag(name, FALSE);
}
else {
vStringClear (name);
if (! isspace(*line))
vStringCatS(name, (const char*) line);
vStringTerminate(name);
}
}
vStringDelete (name);
}
extern parserDefinition* AbcParser (void)
{
static const char *const patterns [] = { "*.abc", NULL };
static const char *const extensions [] = { "abc", NULL };
parserDefinition* const def = parserNew ("Abc");
def->kinds = AbcKinds;
def->kindCount = KIND_COUNT (AbcKinds);
def->patterns = patterns;
def->extensions = extensions;
def->parser = findAbcTags;
return def;
}