diff --git a/ChangeLog b/ChangeLog index c46c80db..22a674f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-05-12 Nick Treleaven + + * 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 * tagmanager/makefile.win32, tagmanager/nestlevel.c, diff --git a/tagmanager/nestlevel.c b/tagmanager/nestlevel.c index ccb26daa..62325573 100644 --- a/tagmanager/nestlevel.c +++ b/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) { diff --git a/tagmanager/nestlevel.h b/tagmanager/nestlevel.h index aacebc4b..90b75fee 100644 --- a/tagmanager/nestlevel.h +++ b/tagmanager/nestlevel.h @@ -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); diff --git a/tagmanager/python.c b/tagmanager/python.c index 18b83431..5ed9931e 100644 --- a/tagmanager/python.c +++ b/tagmanager/python.c @@ -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. */