Hello,
I submit a new patch for including a popular format among musicians: ABC
notation.
Like for the txt2tags one (which is also included in this patch), there is only
the tagmanager part at the moment.
Abc is praised by many linux users and there are several command line tools for
manipulating it:
http://abcnotation.com/software.html#commandline
It's already included into kate and jed:
http://abcplus.sourceforge.net/#JedABC
With the tagmanager in geany, it makes it really conveniant to browse tunes
books this way because you can select the tune by number or title.
try for example:
http://concertina.datenbrei.de/downloads/steierm1.abc
Index: src/filetypes.c
===================================================================
--- src/filetypes.c (révision 4162)
+++ src/filetypes.c (copie de travail)
@@ -379,7 +379,29 @@
ft->comment_open = NULL;
ft->comment_close = NULL;
ft->group = GEANY_FILETYPE_GROUP_MISC;
+
+#define TXT2TAGS
+ ft = filetypes[GEANY_FILETYPES_TXT2TAGS];
+ ft->lang = 37;
+ ft->name = g_strdup("Txt2tags");
+ filetype_make_title(ft, TITLE_SOURCE_FILE);
+ ft->extension = g_strdup("t2t");
+ ft->pattern = utils_strv_new("*.t2t", "*.txt2tags", NULL);
+ ft->comment_open = NULL;
+ 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 musical notation");
+ 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;
Index: src/filetypes.h
===================================================================
--- src/filetypes.h (révision 4162)
+++ src/filetypes.h (copie de travail)
@@ -78,6 +78,8 @@
GEANY_FILETYPES_ADA,
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 */
}
Index: tagmanager/parsers.h
===================================================================
--- tagmanager/parsers.h (révision 4162)
+++ tagmanager/parsers.h (copie de travail)
@@ -51,7 +51,9 @@
ValaParser, \
ActionScriptParser, \
NsisParser, \
- MarkdownParser
+ MarkdownParser, \
+ Txt2tagsParser, \
+ AbcParser
/*
langType of each parser
0 CParser
@@ -91,6 +93,8 @@
34 ActionScriptParser
35 NsisParser
36 MarkdownParser
+37 Txt2tagsParser
+38 AbcParser
*/
#endif /* _PARSERS_H */
Index: tagmanager/makefile.win32
===================================================================
--- tagmanager/makefile.win32 (révision 4162)
+++ tagmanager/makefile.win32 (copie de travail)
@@ -39,11 +39,11 @@
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 \
-parse.o basic.o read.o sort.o strlist.o latex.o markdown.o matlab.o docbook.o tcl.o ruby.o asm.o sql.o css.o \
+parse.o basic.o read.o sort.o strlist.o latex.o markdown.o matlab.o docbook.o tcl.o ruby.o asm.o sql.o text2tags.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
$(AR) rc $@ $^
Index: tagmanager/txt2tags.c
===================================================================
--- tagmanager/txt2tags.c (révision 0)
+++ tagmanager/txt2tags.c (révision 0)
@@ -0,0 +1,132 @@
+/*
+* 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 Txt2tags 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 Txt2tagsKinds[] = {
+ { TRUE, 'v', "variable", "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 makeTxt2tagsTag (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 = "variable";
+ e.kind = 'v';
+
+ makeTagEntry(&e);
+}
+
+static void makeTxt2tagsTag2 (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 findTxt2tagsTags (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))
+ {
+ makeTxt2tagsTag(name, TRUE);
+ }*/
+ if (line[0] == '=') {
+// vStringClear(name);
+ vStringCatS(name, (const char *) line);
+ vStringTerminate(name);
+ makeTxt2tagsTag(name, FALSE);
+ }
+ /*else if (line[0] == "=") {
+ vStringClear(name);
+ vStringCatS(name, (const char *) line);
+ vStringTerminate(name);
+ makeTxt2tagsTag(name, FALSE);
+ }*/
+ else if (line[0] == '°') {
+ /*vStringClear(name);*/
+ vStringCatS(name, (const char *) line);
+ vStringTerminate(name);
+ makeTxt2tagsTag(name, FALSE);
+ }
+ else {
+ vStringClear (name);
+ if (! isspace(*line))
+ vStringCatS(name, (const char*) line);
+ vStringTerminate(name);
+ }
+ }
+ vStringDelete (name);
+}
+
+extern parserDefinition* Txt2tagsParser (void)
+{
+ static const char *const patterns [] = { "*.t2t", NULL };
+ static const char *const extensions [] = { "t2t", NULL };
+ parserDefinition* const def = parserNew ("Txt2tags");
+
+ def->kinds = Txt2tagsKinds;
+ def->kindCount = KIND_COUNT (Txt2tagsKinds);
+ def->patterns = patterns;
+ def->extensions = extensions;
+ def->parser = findTxt2tagsTags;
+ return def;
+}
+
Index: tagmanager/abc.c
===================================================================
--- tagmanager/abc.c (révision 0)
+++ tagmanager/abc.c (révision 0)
@@ -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, 'v', "variable", "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 = "variable";
+ e.kind = 'v';
+
+ 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;
+}
+
Index: tagmanager/Makefile.am
===================================================================
--- tagmanager/Makefile.am (révision 4162)
+++ tagmanager/Makefile.am (copie de travail)
@@ -32,6 +32,7 @@
read.h\
parse.h\
strlist.h\
+ abc.c\
args.c\
args.h\
basic.c\
@@ -61,6 +62,7 @@
python.c\
tcl.c\
sh.c\
+ txt2tags.c\
vhdl.c\
actionscript.c\
nsis.c\
Index: data/filetype_extensions.conf
===================================================================
--- data/filetype_extensions.conf (révision 4162)
+++ data/filetype_extensions.conf (copie de travail)
@@ -2,6 +2,7 @@
# Insert as many items as you want, seperate them with a ";".
# See Geany's main documentation for details.
[Extensions]
+Abc=*.abc;*.abp;
ASM=*.asm;
Ada=*.adb;*.ads;
C=*.c;*.h;
@@ -43,6 +44,7 @@
Po=*.po;*.pot;
LaTeX=*.tex;*.sty;*.idx;*.ltx;
reStructuredText=*.rest;*.reST;*.rst;
+txt2tags=*.t2t;
SQL=*.sql;
YAML=*.yaml;*.yml;
None=*;
Index: HACKING
===================================================================
--- HACKING (révision 4162)
+++ HACKING (copie de travail)
@@ -295,11 +295,17 @@
In filetypes.c, init_builtin_filetypes():
Set filetypes[GEANY_FILETYPES_FOO].lang = foo's parser number.
-In symbols.c:
+In filetypes.h:
+Add GEANY_FILETYPES_ for filetype_id.
+
+(In symbols.c:
Update init_tag_list() for foo, listing the tm_tag_* types corresponding
-to the s_tag_type_names strings used in foo.c for FooKinds.
+to the s_tag_type_names strings used in foo.c for FooKinds.)
+=> is it really still needed ? Can't find the init_tag_list...
+
+
GDB
---
_______________________________________________
Geany-devel mailing list
[email protected]
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel