SF.net SVN: geany:[2908] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Aug 27 12:44:55 UTC 2008


Revision: 2908
          http://geany.svn.sourceforge.net/geany/?rev=2908&view=rev
Author:   ntrel
Date:     2008-08-27 12:44:54 +0000 (Wed, 27 Aug 2008)

Log Message:
-----------
Add OpenGL Shader Language (GLSL) filetype (patch from Colomban 
Wendling, thanks; closes #2060961).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/THANKS
    trunk/data/filetype_extensions.conf
    trunk/src/filetypes.c
    trunk/src/filetypes.h
    trunk/src/highlighting.c
    trunk/src/plugindata.h
    trunk/src/symbols.c
    trunk/tagmanager/c.c
    trunk/tagmanager/parsers.h

Added Paths:
-----------
    trunk/data/filetypes.glsl

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/ChangeLog	2008-08-27 12:44:54 UTC (rev 2908)
@@ -1,3 +1,12 @@
+2008-08-27  Nick Treleaven  <nick.treleaven<at>btinternet.com>
+
+ * src/highlighting.c, src/plugindata.h, src/filetypes.c, 
+   src/filetypes.h, src/symbols.c, THANKS, tagmanager/parsers.h, 
+   tagmanager/c.c, data/filetypes.glsl, data/filetype_extensions.conf:
+   Add OpenGL Shader Language (GLSL) filetype (patch from Colomban 
+   Wendling, thanks; closes #2060961).
+
+
 2008-08-26  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/highlighting.c:

Modified: trunk/THANKS
===================================================================
--- trunk/THANKS	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/THANKS	2008-08-27 12:44:54 UTC (rev 2908)
@@ -45,6 +45,7 @@
 Matti Mårds <mamaar(at)gmail(dot)com> - create PHP tags script
 Robert McGinley <mcginleyr1(at)gmail(dot)com> - Documentation improvements
 Felipe Pena <felipensp(at)gmail(dot)com> - Missing PHP keywords
+Colomban Wendling <colombanw(at)users(dot)sourceforge(dot)net> - GLSL filetype patch
 
 Translators:
 ------------

Modified: trunk/data/filetype_extensions.conf
===================================================================
--- trunk/data/filetype_extensions.conf	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/data/filetype_extensions.conf	2008-08-27 12:44:54 UTC (rev 2908)
@@ -13,6 +13,7 @@
 F77=*.f;*.for;*.ftn;*.f77;
 Fortran=*.f90;*.f95;*.f03;
 FreeBasic=*.bas;*.bi;
+GLSL=*.glsl;*.frag;*.vert
 Haskell=*.hs;*.lhs;
 Haxe=*.hx;
 Java=*.java;*.jsp;

Added: trunk/data/filetypes.glsl
===================================================================
--- trunk/data/filetypes.glsl	                        (rev 0)
+++ trunk/data/filetypes.glsl	2008-08-27 12:44:54 UTC (rev 2908)
@@ -0,0 +1,68 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling]
+# foreground;background;bold;italic
+default=0x000000;0xffffff;false;false
+comment=0xd00000;0xffffff;false;false
+commentline=0xd00000;0xffffff;false;false
+commentdoc=0x3f5fbf;0xffffff;false;false
+number=0x007f00;0xffffff;false;false
+word=0x00007f;0xffffff;true;false
+word2=0x991111;0xffffff;true;false
+string=0xff901e;0xffffff;false;false
+character=0xff901e;0xffffff;false;false
+uuid=0x404080;0xffffff;false;false
+preprocessor=0x007F7F;0xffffff;false;false
+operator=0x301010;0xffffff;false;false
+identifier=0x000000;0xffffff;false;false
+stringeol=0x000000;0xe0c0e0;false;false
+verbatim=0x101030;0xffffff;false;false
+regex=0x105090;0xffffff;false;false
+commentlinedoc=0x3f5fbf;0xffffff;true;false
+commentdockeyword=0x3f5fbf;0xffffff;true;true
+commentdockeyworderror=0x3f5fbf;0xffffff;false;false
+globalclass=0x0000d0;0xffffff;true;false
+# whether arguments of preprocessor commands should be styled (only first argument is used)
+# 1 to enable, 0 to disable
+styling_within_preprocessor=1;0;false;false
+
+[keywords]
+# all items must be in one line
+primary=if else switch case default for while do discard return break continue true false struct void bool int uint float vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 uvec2 uvec3 uvec4 mat2 mat3 mat4 mat2x2 mat2x3 mat2x4 mat3x2 mat3x3 mat3x4 mat4x2 mat4x3 mat4x4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow sampler1DArray sampler2DArray sampler1DArrayShadow sampler2DArrayShadow isampler1D isampler2D isampler3D isamplerCube isampler1DArray isampler2DArray usampler1D usampler2D usampler3D usamplerCube usampler1DArray usampler2DArray const invariant centroid in out inout attribute uniform varying smooth flat noperspective highp mediump lowp
+secondary=
+# these are some doxygen keywords (incomplete)
+docComment=attention author brief bug class code date def enum example exception file fn namespace note param remarks return returns see since struct throw todo typedef var version warning union
+
+[settings]
+# default extension used when saving files
+#extension=glsl
+
+# the following characters are these which a "word" can contains, see documentation
+#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+
+# if only single comment char is supported like # in this file, leave comment_close blank
+comment_open=//
+comment_close=
+# this is an alternative way, so multiline comments are used
+#comment_open=/*
+#comment_close=*/
+
+# set to false if a comment character/string should start at column 0 of a line, true uses any
+# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
+	#command_example();
+# setting to false would generate this
+#	command_example();
+# This setting works only for single line comments
+comment_use_indent=true
+
+# context action command (please see Geany's main documentation for details)
+context_action_cmd=
+
+[build_settings]
+# %f will be replaced by the complete filename
+# %e will be replaced by the filename without extension
+# (use only one of it at one time)
+#compiler=
+#linker=
+#run_cmd=
+
+


Property changes on: trunk/data/filetypes.glsl
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/src/filetypes.c	2008-08-27 12:44:54 UTC (rev 2908)
@@ -167,6 +167,16 @@
 	ft->comment_open = g_strdup("c");
 	ft->comment_close = NULL;
 
+#define GLSL
+	ft = filetypes[GEANY_FILETYPES_GLSL];
+	ft->lang = 31;
+	ft->name = g_strdup("GLSL");
+	ft->title = g_strdup_printf(_("%s source file"), "GLSL");
+	ft->extension = g_strdup("glsl");
+	ft->pattern = utils_strv_new("*.glsl", "*.frag", "*.vert", NULL);
+	ft->comment_open = g_strdup("/*");
+	ft->comment_close = g_strdup("*/");
+
 #define CAML
 	ft = filetypes[GEANY_FILETYPES_CAML];
 	ft->lang = -2;

Modified: trunk/src/filetypes.h
===================================================================
--- trunk/src/filetypes.h	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/src/filetypes.h	2008-08-27 12:44:54 UTC (rev 2908)
@@ -45,6 +45,7 @@
 	GEANY_FILETYPES_F77,
 	GEANY_FILETYPES_FORTRAN,
 	GEANY_FILETYPES_BASIC,	/* FreeBasic */
+	GEANY_FILETYPES_GLSL,
 	GEANY_FILETYPES_HASKELL,
 	GEANY_FILETYPES_HAXE,
 	GEANY_FILETYPES_JAVA,

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/src/highlighting.c	2008-08-27 12:44:54 UTC (rev 2908)
@@ -793,6 +793,61 @@
 }
 
 
+static void styleset_glsl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
+{
+	new_style_array(GEANY_FILETYPES_GLSL, 21);
+	styleset_c_like_init(config, config_home, GEANY_FILETYPES_GLSL);
+	get_keyfile_int(config, config_home, "styling", "styling_within_preprocessor",
+		1, 0, &style_sets[GEANY_FILETYPES_GLSL].styling[20]);
+
+	style_sets[GEANY_FILETYPES_GLSL].keywords = g_new(gchar*, 4);
+	get_keyfile_keywords(config, config_home, "keywords", "primary", GEANY_FILETYPES_GLSL, 0,
+			"if else switch case default for while do discard return break"
+			"continue true false struct void bool int uint float vec2 vec3"
+			"vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 uvec2 uvec3 uvec4 mat2"
+			"mat3 mat4 mat2x2 mat2x3 mat2x4 mat3x2 mat3x3 mat3x4 mat4x2 mat4x3"
+			"mat4x4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow"
+			"sampler2DShadow sampler1DArray sampler2DArray sampler1DArrayShadow"
+			"sampler2DArrayShadow isampler1D isampler2D isampler3D isamplerCube"
+			"isampler1DArray isampler2DArray usampler1D usampler2D usampler3D"
+			"usamplerCube usampler1DArray usampler2DArray const invariant"
+			"centroid in out inout attribute uniform varying smooth flat"
+			"noperspective highp mediump lowp");
+	get_keyfile_keywords(config, config_home, "keywords", "secondary", GEANY_FILETYPES_GLSL, 1, "");
+	get_keyfile_keywords(config, config_home, "keywords", "docComment", GEANY_FILETYPES_GLSL, 2, "TODO FIXME");
+	style_sets[GEANY_FILETYPES_GLSL].keywords[3] = NULL;
+
+	get_keyfile_wordchars(config, config_home,
+		&style_sets[GEANY_FILETYPES_GLSL].wordchars);
+}
+
+
+static void styleset_glsl(ScintillaObject *sci)
+{
+	const filetype_id ft_id = GEANY_FILETYPES_GLSL;
+
+	styleset_common(sci, 5, ft_id);
+
+	apply_filetype_properties(sci, SCLEX_CPP, ft_id);
+
+	SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_GLSL].keywords[0]);
+	/* for SCI_SETKEYWORDS = 1, see below*/
+	SSM(sci, SCI_SETKEYWORDS, 2, (sptr_t) style_sets[GEANY_FILETYPES_GLSL].keywords[2]);
+
+	/* assign global types, merge them with user defined keywords and set them */
+	assign_global_and_user_keywords(sci, style_sets[GEANY_FILETYPES_GLSL].keywords[1],
+		filetypes[ft_id]->lang);
+
+	styleset_c_like(sci, GEANY_FILETYPES_GLSL);
+
+	if (style_sets[GEANY_FILETYPES_GLSL].styling[20].foreground == 1)
+		SSM(sci, SCI_SETPROPERTY, (sptr_t) "styling.within.preprocessor", (sptr_t) "1");
+	SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.symbol.$(file.patterns.cpp)", (sptr_t) "#");
+	SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.start.$(file.patterns.cpp)", (sptr_t) "if ifdef ifndef");
+	SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.middle.$(file.patterns.cpp)", (sptr_t) "else elif");
+	SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.end.$(file.patterns.cpp)", (sptr_t) "endif");
+}
+
 static void styleset_cs_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
 {
 	new_style_array(GEANY_FILETYPES_CS, 21);
@@ -2979,6 +3034,7 @@
 		init_styleset_case(GEANY_FILETYPES_FERITE,	ferite);
 		init_styleset_case(GEANY_FILETYPES_F77,		f77);
 		init_styleset_case(GEANY_FILETYPES_FORTRAN,	fortran);
+		init_styleset_case(GEANY_FILETYPES_GLSL,	glsl);
 		init_styleset_case(GEANY_FILETYPES_HASKELL,	haskell);
 		init_styleset_case(GEANY_FILETYPES_HAXE,	haxe);
 		init_styleset_case(GEANY_FILETYPES_HTML,	html);
@@ -3032,6 +3088,7 @@
 		styleset_case(GEANY_FILETYPES_FERITE,	ferite);
 		styleset_case(GEANY_FILETYPES_F77,		f77);
 		styleset_case(GEANY_FILETYPES_FORTRAN,	fortran);
+		styleset_case(GEANY_FILETYPES_GLSL,		glsl);
 		styleset_case(GEANY_FILETYPES_HASKELL,	haskell);
 		styleset_case(GEANY_FILETYPES_HAXE,		haxe);
 		styleset_case(GEANY_FILETYPES_HTML,		html);

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/src/plugindata.h	2008-08-27 12:44:54 UTC (rev 2908)
@@ -41,13 +41,13 @@
 enum {
 	/** The Application Programming Interface (API) version, incremented
 	 * whenever any plugin data types are modified or appended to. */
-	GEANY_API_VERSION = 89,
+	GEANY_API_VERSION = 90,
 
 	/** The Application Binary Interface (ABI) version, incremented whenever
 	 * existing fields in the plugin data types have to be changed or reordered. */
 	/* This should usually stay the same if fields are only appended, assuming only pointers to
 	 * structs and not structs themselves are declared by plugins. */
-	GEANY_ABI_VERSION = 44
+	GEANY_ABI_VERSION = 45
 };
 
 /** Check the plugin can be loaded by Geany.

Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/src/symbols.c	2008-08-27 12:44:54 UTC (rev 2908)
@@ -232,6 +232,7 @@
 	{
 		case GEANY_FILETYPES_C:	/* for C++ .h headers or C structs */
 		case GEANY_FILETYPES_CPP:
+		case GEANY_FILETYPES_GLSL:	/* for structs */
 		/*case GEANY_FILETYPES_RUBY:*/ /* not sure what to use atm*/
 		{
 			static gchar cc[] = "::";

Modified: trunk/tagmanager/c.c
===================================================================
--- trunk/tagmanager/c.c	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/tagmanager/c.c	2008-08-27 12:44:54 UTC (rev 2908)
@@ -247,6 +247,7 @@
 static langType Lang_csharp;
 static langType Lang_java;
 static langType Lang_d;
+static langType Lang_glsl;
 static langType Lang_ferite;
 
 /* Used to index into the CKinds table. */
@@ -2772,6 +2773,13 @@
     buildKeywordHash (language, 1);	/* C++ keywords */
 }
 
+static void initializeGLSLParser (const langType language)
+{
+    contextual_fake_count = 0;
+    Lang_glsl = language;
+    buildKeywordHash (language, 0);
+}
+
 static void initializeFeriteParser (const langType language)
 {
     contextual_fake_count = 0;
@@ -2841,6 +2849,18 @@
     return def;
 }
 
+extern parserDefinition* GLSLParser (void)
+{
+    static const char *const extensions [] = { "glsl", "frag", "vert", NULL };
+    parserDefinition* def = parserNew ("GLSL");
+    def->kinds      = CKinds;
+    def->kindCount  = KIND_COUNT (CKinds);
+    def->extensions = extensions;
+    def->parser2    = findCTags;
+    def->initialize = initializeGLSLParser;
+    return def;
+}
+
 extern parserDefinition* FeriteParser (void)
 {
     static const char *const extensions [] = { "fe", NULL };

Modified: trunk/tagmanager/parsers.h
===================================================================
--- trunk/tagmanager/parsers.h	2008-08-26 16:30:25 UTC (rev 2907)
+++ trunk/tagmanager/parsers.h	2008-08-27 12:44:54 UTC (rev 2908)
@@ -45,7 +45,8 @@
     HaxeParser,\
     RestParser, \
     HtmlParser, \
-    F77Parser
+    F77Parser, \
+    GLSLParser
 
 /*
 langType of each parser
@@ -80,6 +81,7 @@
 28  RestParser
 29  HtmlParser
 30  F77Parser
+31  GLSLParser
 */
 #endif	/* _PARSERS_H */
 


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