SF.net SVN: geany:[3196] branches/build-system

elextr at users.sourceforge.net elextr at xxxxx
Mon Nov 10 12:28:06 UTC 2008


Revision: 3196
          http://geany.svn.sourceforge.net/geany/?rev=3196&view=rev
Author:   elextr
Date:     2008-11-10 12:28:06 +0000 (Mon, 10 Nov 2008)

Log Message:
-----------
Prototype C and C++ header filetypes

Modified Paths:
--------------
    branches/build-system/ChangeLog
    branches/build-system/data/filetype_extensions.conf
    branches/build-system/src/filetypes.c
    branches/build-system/src/filetypes.h
    branches/build-system/src/highlighting.c

Added Paths:
-----------
    branches/build-system/data/filetypes.h
    branches/build-system/data/filetypes.hpp

Modified: branches/build-system/ChangeLog
===================================================================
--- branches/build-system/ChangeLog	2008-11-10 00:49:16 UTC (rev 3195)
+++ branches/build-system/ChangeLog	2008-11-10 12:28:06 UTC (rev 3196)
@@ -1,5 +1,25 @@
 2008-11-10  Lex Trotman  <elextr(at)gmail(dot)com>
 
+   Prototype C and CPP header filetypes, also detects .h or no extension
+   files with -*-C++-*- on line 1 as C++ header
+
+ * src/highlighting.c
+   highlighting_set_styles() & highlighting_init_styles() added filetypes
+   H & HPP to switches
+ * src/filetypes.h
+   added H and HPP to filetypes enum, changed guard name to aviod clash
+   with GEANY_FILETYPE_H
+ * src/filetypes.c
+   init_builtin_filetypes() added new filetypes for H and HPP and moved
+   header extensions from C and CPP to them
+   filetypes_detect_from_file_internal() if extensions are .h or none check
+   for '-*-C++-*-' on line 1 and set to filetype HPP if found
+ * data/filetypes.h and data/filetypes.hpp added (copies of .c and .cpp)
+ * data/extensions.conf added H and H++ types
+
+
+2008-11-10  Lex Trotman  <elextr(at)gmail(dot)com>
+
 	Fixed build menu updating after dialog close
 	
  * src/build.c:

Modified: branches/build-system/data/filetype_extensions.conf
===================================================================
--- branches/build-system/data/filetype_extensions.conf	2008-11-10 00:49:16 UTC (rev 3195)
+++ branches/build-system/data/filetype_extensions.conf	2008-11-10 12:28:06 UTC (rev 3196)
@@ -5,8 +5,10 @@
 #See Geany's main documentation for details.
 [Extensions]
 ASM=*.asm;
-C=*.c;*.h;
-C++=*.cpp;*.cxx;*.c++;*.cc;*.h;*.hpp;*.hxx;*.h++;*.hh;*.C;
+C=*.c;
+H=*.h;
+C++=*.cpp;*.cxx;*.c++;*.cc;*.C;
+H++=*.hpp;*.h;*.hxx;*.h++;*.hh;
 C#=*.cs;*.vala;
 CAML=*.ml;*.mli;
 D=*.d;*.di;

Added: branches/build-system/data/filetypes.h
===================================================================
--- branches/build-system/data/filetypes.h	                        (rev 0)
+++ branches/build-system/data/filetypes.h	2008-11-10 12:28:06 UTC (rev 3196)
@@ -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=volatile default export goto sizeof typename asm enum bool union NULL FALSE TRUE typedef struct char int float double void unsigned signed long short extern static register auto const if else switch for while do break continue return inline case
+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 see since struct throw todo typedef var version warning union
+
+[settings]
+# default extension used when saving files
+#extension=c
+
+# 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=gcc -Wall -c "%f"
+linker=
+run_cmd=
+
+


Property changes on: branches/build-system/data/filetypes.h
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/build-system/data/filetypes.hpp
===================================================================
--- branches/build-system/data/filetypes.hpp	                        (rev 0)
+++ branches/build-system/data/filetypes.hpp	2008-11-10 12:28:06 UTC (rev 3196)
@@ -0,0 +1,67 @@
+# 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=and and_eq asm auto bitand bitor bool break case catch char class compl const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new not not_eq operator or or_eq private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while xor xor_eq
+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 see since struct throw todo typedef var version warning union
+
+[settings]
+# default extension used when saving files
+#extension=cpp
+
+# 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=g++ -Wall -c "%f"
+linker=
+run_cmd=
+


Property changes on: branches/build-system/data/filetypes.hpp
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/build-system/src/filetypes.c
===================================================================
--- branches/build-system/src/filetypes.c	2008-11-10 00:49:16 UTC (rev 3195)
+++ branches/build-system/src/filetypes.c	2008-11-10 12:28:06 UTC (rev 3196)
@@ -84,10 +84,21 @@
 	ft->name = g_strdup("C");
 	ft->title = g_strdup_printf(_("%s source file"), "C");
 	ft->extension = g_strdup("c");
-	ft->pattern = utils_strv_new("*.c", "*.h", NULL);
+	ft->pattern = utils_strv_new("*.c", NULL);
 	ft->comment_open = g_strdup("/*");
 	ft->comment_close = g_strdup("*/");
 	ft->group = GEANY_FILETYPE_GROUP_COMPILED;
+	
+#define CH
+	ft = filetypes[GEANY_FILETYPES_H];
+	ft->lang = 0;
+	ft->name = g_strdup("H");
+	ft->title = g_strdup_printf(_("%s header file"), "C");
+	ft->extension = g_strdup("h");
+	ft->pattern = utils_strv_new("*.h", NULL);
+	ft->comment_open = g_strdup("/*");
+	ft->comment_close = g_strdup("*/");
+	ft->group = GEANY_FILETYPE_GROUP_COMPILED;
 
 #define CPP
 	ft = filetypes[GEANY_FILETYPES_CPP];
@@ -96,10 +107,21 @@
 	ft->title = g_strdup_printf(_("%s source file"), "C++");
 	ft->extension = g_strdup("cpp");
 	ft->pattern = utils_strv_new("*.cpp", "*.cxx", "*.c++", "*.cc",
-		"*.h", "*.hpp", "*.hxx", "*.h++", "*.hh", "*.C", NULL);
+		"*.C", NULL);
 	ft->comment_open = g_strdup("//");
 	ft->comment_close = NULL;
 	ft->group = GEANY_FILETYPE_GROUP_COMPILED;
+	
+#define HPP
+	ft = filetypes[GEANY_FILETYPES_HPP];
+	ft->lang = 1;
+	ft->name = g_strdup("H++");
+	ft->title = g_strdup_printf(_("%s header file"), "C++");
+	ft->extension = g_strdup("hpp");
+	ft->pattern = utils_strv_new("*.h", "*.hpp", "*.hxx", "*.h++", "*.hh", NULL);
+	ft->comment_open = g_strdup("//");
+	ft->comment_close = NULL;
+	ft->group = GEANY_FILETYPE_GROUP_COMPILED;
 
 #define CS
 	ft = filetypes[GEANY_FILETYPES_CS];
@@ -767,6 +789,7 @@
 														  const gchar *line)
 {
 	GeanyFiletype *ft;
+	filetype_id id;
 
 	/* try to find a shebang and if found use it prior to the filename extension
 	 * also checks for <?xml */
@@ -775,9 +798,16 @@
 		return ft;
 
 	if (utf8_filename == NULL)
-		return filetypes[GEANY_FILETYPES_NONE];
-
-	return filetypes_detect_from_extension(utf8_filename);
+		ft = filetypes[GEANY_FILETYPES_NONE];
+	else
+		ft = filetypes_detect_from_extension(utf8_filename);
+	id = FILETYPE_ID(ft);
+	if (id == GEANY_FILETYPES_H || id == GEANY_FILETYPES_NONE)
+	{
+		if (strstr(line, "-*-C++-*-"))
+			ft = filetypes[GEANY_FILETYPES_HPP];
+	}
+	return ft;
 }
 
 

Modified: branches/build-system/src/filetypes.h
===================================================================
--- branches/build-system/src/filetypes.h	2008-11-10 00:49:16 UTC (rev 3195)
+++ branches/build-system/src/filetypes.h	2008-11-10 12:28:06 UTC (rev 3196)
@@ -22,8 +22,8 @@
  */
 
 
-#ifndef GEANY_FILETYPES_H
-#define GEANY_FILETYPES_H 1
+#ifndef HAVE_GEANY_FILETYPES_H
+#define HAVE_GEANY_FILETYPES_H 1
 
 #include "Scintilla.h"
 #include "ScintillaWidget.h"
@@ -38,7 +38,9 @@
 	/* normally compiled languages */
 	GEANY_FILETYPES_ASM = 0,
 	GEANY_FILETYPES_C,
+	GEANY_FILETYPES_H,
 	GEANY_FILETYPES_CPP,
+	GEANY_FILETYPES_HPP,
 	GEANY_FILETYPES_CS,
 	GEANY_FILETYPES_CAML,
 	GEANY_FILETYPES_D,

Modified: branches/build-system/src/highlighting.c
===================================================================
--- branches/build-system/src/highlighting.c	2008-11-10 00:49:16 UTC (rev 3195)
+++ branches/build-system/src/highlighting.c	2008-11-10 12:28:06 UTC (rev 3196)
@@ -3063,9 +3063,11 @@
 		init_styleset_case(GEANY_FILETYPES_ASM,		asm);
 		init_styleset_case(GEANY_FILETYPES_BASIC,	basic);
 		init_styleset_case(GEANY_FILETYPES_C,		c);
+		init_styleset_case(GEANY_FILETYPES_H,		c);
 		init_styleset_case(GEANY_FILETYPES_CAML,	caml);
 		init_styleset_case(GEANY_FILETYPES_CONF,	conf);
 		init_styleset_case(GEANY_FILETYPES_CPP,		cpp);
+		init_styleset_case(GEANY_FILETYPES_HPP,		cpp);
 		init_styleset_case(GEANY_FILETYPES_CS,		cs);
 		init_styleset_case(GEANY_FILETYPES_CSS,		css);
 		init_styleset_case(GEANY_FILETYPES_D,		d);
@@ -3119,9 +3121,11 @@
 		styleset_case(GEANY_FILETYPES_ASM,		asm);
 		styleset_case(GEANY_FILETYPES_BASIC,	basic);
 		styleset_case(GEANY_FILETYPES_C,		c);
+		styleset_case(GEANY_FILETYPES_H,		c);
 		styleset_case(GEANY_FILETYPES_CAML,		caml);
 		styleset_case(GEANY_FILETYPES_CONF,		conf);
 		styleset_case(GEANY_FILETYPES_CPP,		cpp);
+		styleset_case(GEANY_FILETYPES_HPP,		cpp);
 		styleset_case(GEANY_FILETYPES_CS,		cs);
 		styleset_case(GEANY_FILETYPES_CSS,		css);
 		styleset_case(GEANY_FILETYPES_D,		d);


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