Permalink
Browse files

Add new filetype: Abc (patch by Eric Forgeot, thanks).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4211 ea778897-0a13-0410-b9d1-a72fbfd435f5
  • Loading branch information...
eht16 committed Sep 20, 2009
1 parent c786d69 commit b84a64934df1138e3a5b6422efee9a1aeaa45219
Showing with 165 additions and 3 deletions.
  1. +9 −0 ChangeLog
  2. +1 −0 data/filetype_extensions.conf
  3. +9 −0 data/filetypes.abc
  4. +11 −0 src/filetypes.c
  5. +1 −0 src/filetypes.h
  6. +1 −0 src/symbols.c
  7. +1 −0 tagmanager/Makefile.am
  8. +127 −0 tagmanager/abc.c
  9. +1 −1 tagmanager/makefile.win32
  10. +3 −1 tagmanager/parsers.h
  11. +1 −1 wscript
View
@@ -1,3 +1,12 @@
+2009-09-20 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/filetypes.c, src/filetypes.h, src/symbols.c,
+ tagmanager/parsers.h, tagmanager/makefile.win32,
+ tagmanager/abc.c, tagmanager/Makefile.am, data/filetypes.abc,
+ data/filetype_extensions.conf, wscript:
+
+
+
2009-09-17 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/printing.c:
@@ -3,6 +3,7 @@
# See Geany's main documentation for details.
[Extensions]
ASM=*.asm;
+Abc=*.abc;*.abp;
Ada=*.adb;*.ads;
C=*.c;*.h;
C++=*.cpp;*.cxx;*.c++;*.cc;*.h;*.hpp;*.hxx;*.h++;*.hh;*.C;*.H;
View
@@ -0,0 +1,9 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling]
+# no syntax highlighting yet
+
+[settings]
+# default extension used when saving files
+extension=abc
+
+
View
@@ -391,6 +391,17 @@ static void init_builtin_filetypes(void)
ft->comment_close = NULL;
ft->group = GEANY_FILETYPE_GROUP_MISC;
+#define ABC
+ ft = filetypes[GEANY_FILETYPES_ABC];
+ ft->lang = 38;
+ ft->name = g_strdup("Abc");
+ filetype_make_title(ft, TITLE_SOURCE_FILE);
+ ft->extension = g_strdup("abc");
+ ft->pattern = utils_strv_new("*.abc", "*.abp", NULL);
+ ft->comment_open = NULL;
+ ft->comment_close = NULL;
+ ft->group = GEANY_FILETYPE_GROUP_MISC;
+
#define SH
ft = filetypes[GEANY_FILETYPES_SH];
ft->lang = 16;
View
@@ -79,6 +79,7 @@ typedef enum
GEANY_FILETYPES_CMAKE,
GEANY_FILETYPES_MARKDOWN,
GEANY_FILETYPES_TXT2TAGS,
+ GEANY_FILETYPES_ABC,
/* ^ append items here */
GEANY_MAX_BUILT_IN_FILETYPES /* Don't use this, use filetypes_array->len instead */
}
View
@@ -696,6 +696,7 @@ static void add_top_level_items(GeanyDocument *doc)
}
case GEANY_FILETYPES_REST:
case GEANY_FILETYPES_TXT2TAGS:
+ case GEANY_FILETYPES_ABC:
{
tag_list_add_groups(tag_store,
&(tv_iters.tag_namespace), _("Chapter"), NULL,
View
@@ -34,6 +34,7 @@ libtagmanager_a_SOURCES =\
strlist.h\
args.c\
args.h\
+ abc.c\
basic.c\
c.c\
conf.c\
View
@@ -0,0 +1,127 @@
+/*
+* 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;
+}
+
@@ -39,7 +39,7 @@ all: $(COMPLIB)
clean:
-$(RM) deps.mak *.o $(COMPLIB)
-$(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 \
+$(COMPLIB): abc.o 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 nestlevel.o \
options.o \
View
@@ -52,7 +52,8 @@
ActionScriptParser, \
NsisParser, \
MarkdownParser, \
- Txt2tagsParser
+ Txt2tagsParser, \
+ AbcParser
/*
langType of each parser
0 CParser
@@ -93,6 +94,7 @@ langType of each parser
35 NsisParser
36 MarkdownParser
37 Txt2tagsParser
+38 AbcParser
*/
#endif /* _PARSERS_H */
View
@@ -61,7 +61,7 @@ blddir = '_build_'
tagmanager_sources = [
- 'tagmanager/args.c', 'tagmanager/actionscript.c', 'tagmanager/asm.c',
+ 'tagmanager/args.c', 'tagmanager/abc.c', 'tagmanager/actionscript.c', 'tagmanager/asm.c',
'tagmanager/basic.c', 'tagmanager/c.c',
'tagmanager/conf.c', 'tagmanager/css.c', 'tagmanager/ctags.c', 'tagmanager/diff.c',
'tagmanager/docbook.c', 'tagmanager/entry.c', 'tagmanager/fortran.c', 'tagmanager/get.c',

0 comments on commit b84a649

Please sign in to comment.