Remove NestingLevel::is_class field, use ::type instead.
Move addNestingLevel() back to python.c. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/unstable@3785 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
58b5c053bc
commit
14653b1ba2
@ -1,3 +1,10 @@
|
||||
2009-05-12 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* tagmanager/nestlevel.c, tagmanager/nestlevel.h, tagmanager/python.c:
|
||||
Remove NestingLevel::is_class field, use ::type instead.
|
||||
Move addNestingLevel() back to python.c.
|
||||
|
||||
|
||||
2009-05-11 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* tagmanager/makefile.win32, tagmanager/nestlevel.c,
|
||||
|
@ -37,36 +37,6 @@ extern void freeNestingLevels(NestingLevels *nls)
|
||||
eFree(nls);
|
||||
}
|
||||
|
||||
/* currently only for indentation langs e.g. python */
|
||||
extern void addNestingLevel(NestingLevels *nls, int indentation,
|
||||
const vString *name, boolean is_class)
|
||||
{
|
||||
int i;
|
||||
NestingLevel *nl = NULL;
|
||||
|
||||
for (i = 0; i < nls->n; i++)
|
||||
{
|
||||
nl = nls->levels + i;
|
||||
if (indentation <= nl->indentation) break;
|
||||
}
|
||||
if (i == nls->n)
|
||||
{
|
||||
if (i >= nls->allocated)
|
||||
{
|
||||
nls->allocated++;
|
||||
nls->levels = xRealloc(nls->levels,
|
||||
nls->allocated, NestingLevel);
|
||||
nls->levels[i].name = vStringNew();
|
||||
}
|
||||
nl = nls->levels + i;
|
||||
}
|
||||
nls->n = i + 1;
|
||||
|
||||
vStringCopy(nl->name, name);
|
||||
nl->indentation = indentation;
|
||||
nl->is_class = is_class;
|
||||
}
|
||||
|
||||
extern void nestingLevelsPush(NestingLevels *nls,
|
||||
const vString *name, int type)
|
||||
{
|
||||
|
@ -30,7 +30,6 @@ struct NestingLevel
|
||||
int indentation;
|
||||
vString *name;
|
||||
int type;
|
||||
boolean is_class; /* should be replaced by type field */
|
||||
};
|
||||
|
||||
struct NestingLevels
|
||||
@ -45,8 +44,6 @@ struct NestingLevels
|
||||
*/
|
||||
extern NestingLevels *newNestingLevels(void);
|
||||
extern void freeNestingLevels(NestingLevels *nls);
|
||||
extern void addNestingLevel(NestingLevels *nls, int indentation,
|
||||
const vString *name, boolean is_class);
|
||||
extern void nestingLevelsPush(NestingLevels *nls,
|
||||
const vString *name, int type);
|
||||
extern void nestingLevelsPop(NestingLevels *nls);
|
||||
|
@ -278,13 +278,13 @@ static boolean constructParentString(NestingLevels *nls, int indent,
|
||||
break;
|
||||
if (prev)
|
||||
{
|
||||
if (prev->is_class)
|
||||
if (prev->type == K_CLASS)
|
||||
vStringCatS(result, ".");
|
||||
else
|
||||
vStringCatS(result, "/");
|
||||
}
|
||||
vStringCat(result, nl->name);
|
||||
is_class = nl->is_class;
|
||||
is_class = (nl->type == K_CLASS);
|
||||
prev = nl;
|
||||
}
|
||||
return is_class;
|
||||
@ -314,6 +314,35 @@ static void checkParent(NestingLevels *nls, int indent, vString *parent)
|
||||
}
|
||||
}
|
||||
|
||||
static void addNestingLevel(NestingLevels *nls, int indentation,
|
||||
const vString *name, boolean is_class)
|
||||
{
|
||||
int i;
|
||||
NestingLevel *nl = NULL;
|
||||
|
||||
for (i = 0; i < nls->n; i++)
|
||||
{
|
||||
nl = nls->levels + i;
|
||||
if (indentation <= nl->indentation) break;
|
||||
}
|
||||
if (i == nls->n)
|
||||
{
|
||||
if (i >= nls->allocated)
|
||||
{
|
||||
nls->allocated++;
|
||||
nls->levels = xRealloc(nls->levels,
|
||||
nls->allocated, NestingLevel);
|
||||
nls->levels[i].name = vStringNew();
|
||||
}
|
||||
nl = nls->levels + i;
|
||||
}
|
||||
nls->n = i + 1;
|
||||
|
||||
vStringCopy(nl->name, name);
|
||||
nl->indentation = indentation;
|
||||
nl->type = is_class ? K_CLASS : !K_CLASS;
|
||||
}
|
||||
|
||||
/* Return a pointer to the start of the next triple string, or NULL. Store
|
||||
* the kind of triple string in "which" if the return is not NULL.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user