SF.net SVN: geany:[3778] branches/unstable
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon May 11 14:15:00 UTC 2009
Revision: 3778
http://geany.svn.sourceforge.net/geany/?rev=3778&view=rev
Author: ntrel
Date: 2009-05-11 14:15:00 +0000 (Mon, 11 May 2009)
Log Message:
-----------
Move NestingLevel code into a separate file.
Modified Paths:
--------------
branches/unstable/ChangeLog
branches/unstable/tagmanager/Makefile.am
branches/unstable/tagmanager/makefile.win32
branches/unstable/tagmanager/python.c
branches/unstable/wscript
Added Paths:
-----------
branches/unstable/tagmanager/nestlevel.c
branches/unstable/tagmanager/nestlevel.h
Modified: branches/unstable/ChangeLog
===================================================================
--- branches/unstable/ChangeLog 2009-05-10 17:44:43 UTC (rev 3777)
+++ branches/unstable/ChangeLog 2009-05-11 14:15:00 UTC (rev 3778)
@@ -1,3 +1,11 @@
+2009-05-11 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * tagmanager/makefile.win32, tagmanager/nestlevel.c,
+ tagmanager/nestlevel.h, tagmanager/python.c, tagmanager/Makefile.am,
+ wscript:
+ Move NestingLevel code into a separate file.
+
+
2009-05-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/symbols.c:
Modified: branches/unstable/tagmanager/Makefile.am
===================================================================
--- branches/unstable/tagmanager/Makefile.am 2009-05-10 17:44:43 UTC (rev 3777)
+++ branches/unstable/tagmanager/Makefile.am 2009-05-11 14:15:00 UTC (rev 3778)
@@ -28,6 +28,7 @@
entry.h\
get.h\
main.h\
+ nestlevel.h\
read.h\
parse.h\
strlist.h\
@@ -66,6 +67,7 @@
entry.c\
get.c\
keyword.c\
+ nestlevel.c\
options.h\
options.c\
parse.c\
Modified: branches/unstable/tagmanager/makefile.win32
===================================================================
--- branches/unstable/tagmanager/makefile.win32 2009-05-10 17:44:43 UTC (rev 3777)
+++ branches/unstable/tagmanager/makefile.win32 2009-05-11 14:15:00 UTC (rev 3778)
@@ -41,7 +41,8 @@
$(COMPLIB): args.o c.o fortran.o make.o conf.o pascal.o perl.o php.o diff.o vhdl.o lua.o js.o \
actionscript.o nsis.o \
-haskell.o haxe.o html.o python.o lregex.o rest.o sh.o ctags.o entry.o get.o keyword.o options.o \
+haskell.o haxe.o html.o python.o lregex.o rest.o sh.o ctags.o entry.o get.o keyword.o nestlevel.o \
+options.o \
parse.o basic.o read.o sort.o strlist.o latex.o matlab.o docbook.o tcl.o ruby.o asm.o sql.o css.o \
vstring.o regex.o tm_workspace.o tm_work_object.o tm_source_file.o tm_project.o tm_tag.o \
tm_symbol.o tm_file_entry.o tm_tagmanager.o
Added: branches/unstable/tagmanager/nestlevel.c
===================================================================
--- branches/unstable/tagmanager/nestlevel.c (rev 0)
+++ branches/unstable/tagmanager/nestlevel.c 2009-05-11 14:15:00 UTC (rev 3778)
@@ -0,0 +1,69 @@
+/*
+* $Id$
+*
+* Copyright (c) 1999-2002, Darren Hiebert
+* Copyright 2009 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+*
+* This source code is released for free distribution under the terms of the
+* GNU General Public License.
+*
+* Defines external interface to scope nesting levels for tags.
+*/
+
+/*
+* INCLUDE FILES
+*/
+#include "general.h" /* must always come first */
+
+#include "main.h"
+#include "nestlevel.h"
+
+/*
+* FUNCTION DEFINITIONS
+*/
+
+extern NestingLevels *newNestingLevels(void)
+{
+ NestingLevels *nls = xCalloc (1, NestingLevels);
+ return nls;
+}
+
+extern void freeNestingLevels(NestingLevels *nls)
+{
+ int i;
+ for (i = 0; i < nls->allocated; i++)
+ vStringDelete(nls->levels[i].name);
+ if (nls->levels) eFree(nls->levels);
+ eFree(nls);
+}
+
+extern void addNestingLevel(NestingLevels *nls, int indentation,
+ 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;
+}
+
+/* vi:set tabstop=4 shiftwidth=4: */
Property changes on: branches/unstable/tagmanager/nestlevel.c
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/unstable/tagmanager/nestlevel.h
===================================================================
--- branches/unstable/tagmanager/nestlevel.h (rev 0)
+++ branches/unstable/tagmanager/nestlevel.h 2009-05-11 14:15:00 UTC (rev 3778)
@@ -0,0 +1,52 @@
+/*
+* $Id$
+*
+* Copyright (c) 1999-2002, Darren Hiebert
+* Copyright 2009 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+*
+* This source code is released for free distribution under the terms of the
+* GNU General Public License.
+*
+* Defines external interface to scope nesting levels for tags.
+*/
+#ifndef _NESTLEVEL_H
+#define _NESTLEVEL_H
+
+/*
+* INCLUDE FILES
+*/
+#include "general.h" /* must always come first */
+
+#include "vstring.h"
+
+/*
+* DATA DECLARATIONS
+*/
+typedef struct NestingLevel NestingLevel;
+typedef struct NestingLevels NestingLevels;
+
+struct NestingLevel
+{
+ int indentation;
+ vString *name;
+ boolean is_class;
+};
+
+struct NestingLevels
+{
+ NestingLevel *levels;
+ int n;
+ int allocated;
+};
+
+/*
+* FUNCTION PROTOTYPES
+*/
+NestingLevels *newNestingLevels(void);
+void freeNestingLevels(NestingLevels *nls);
+void addNestingLevel(NestingLevels *nls, int indentation,
+ vString *name, boolean is_class);
+
+#endif /* _NESTLEVEL_H */
+
+/* vi:set tabstop=4 shiftwidth=4: */
Property changes on: branches/unstable/tagmanager/nestlevel.h
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: branches/unstable/tagmanager/python.c
===================================================================
--- branches/unstable/tagmanager/python.c 2009-05-10 17:44:43 UTC (rev 3777)
+++ branches/unstable/tagmanager/python.c 2009-05-11 14:15:00 UTC (rev 3778)
@@ -21,6 +21,7 @@
#include "read.h"
#include "main.h"
#include "vstring.h"
+#include "nestlevel.h"
/*
* DATA DEFINITIONS
@@ -36,23 +37,6 @@
{TRUE, 'v', "variable", "variables"}
};
-typedef struct NestingLevel NestingLevel;
-typedef struct NestingLevels NestingLevels;
-
-struct NestingLevel
-{
- int indentation;
- vString *name;
- boolean is_class;
-};
-
-struct NestingLevels
-{
- NestingLevel *levels;
- int n;
- int allocated;
-};
-
static char const * const singletriple = "'''";
static char const * const doubletriple = "\"\"\"";
@@ -330,54 +314,6 @@
}
}
-static NestingLevels *newNestingLevels(void)
-{
- NestingLevels *nls = xCalloc (1, NestingLevels);
- return nls;
-}
-
-static void freeNestingLevels(NestingLevels *nls)
-{
- int i;
- for (i = 0; i < nls->allocated; i++)
- vStringDelete(nls->levels[i].name);
- if (nls->levels) eFree(nls->levels);
- eFree(nls);
-}
-
-/* TODO: This is totally out of place in python.c, but strlist.h is not usable.
- * Maybe should just move these three functions to a separate file, even if no
- * other parser uses them.
- */
-static void addNestingLevel(NestingLevels *nls, int indentation,
- 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;
-}
-
/* 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.
*/
Modified: branches/unstable/wscript
===================================================================
--- branches/unstable/wscript 2009-05-10 17:44:43 UTC (rev 3777)
+++ branches/unstable/wscript 2009-05-11 14:15:00 UTC (rev 3778)
@@ -58,7 +58,8 @@
'tagmanager/docbook.c', 'tagmanager/entry.c', 'tagmanager/fortran.c', 'tagmanager/get.c',
'tagmanager/haskell.c', 'tagmanager/haxe.c', 'tagmanager/html.c', 'tagmanager/js.c',
'tagmanager/keyword.c', 'tagmanager/latex.c', 'tagmanager/lregex.c', 'tagmanager/lua.c',
- 'tagmanager/make.c', 'tagmanager/matlab.c', 'tagmanager/nsis.c', 'tagmanager/options.c',
+ 'tagmanager/make.c', 'tagmanager/matlab.c', 'tagmanager/nsis.c',
+ 'tagmanager/nestlevel.c', 'tagmanager/options.c',
'tagmanager/parse.c', 'tagmanager/pascal.c',
'tagmanager/perl.c', 'tagmanager/php.c', 'tagmanager/python.c', 'tagmanager/read.c',
'tagmanager/rest.c', 'tagmanager/ruby.c', 'tagmanager/sh.c', 'tagmanager/sort.c',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list