Prototype C and C++ header filetypes
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/build-system@3196 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
30de1c33b1
commit
1469e56fea
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
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>
|
2008-11-10 Lex Trotman <elextr(at)gmail(dot)com>
|
||||||
|
|
||||||
Fixed build menu updating after dialog close
|
Fixed build menu updating after dialog close
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
#See Geany's main documentation for details.
|
#See Geany's main documentation for details.
|
||||||
[Extensions]
|
[Extensions]
|
||||||
ASM=*.asm;
|
ASM=*.asm;
|
||||||
C=*.c;*.h;
|
C=*.c;
|
||||||
C++=*.cpp;*.cxx;*.c++;*.cc;*.h;*.hpp;*.hxx;*.h++;*.hh;*.C;
|
H=*.h;
|
||||||
|
C++=*.cpp;*.cxx;*.c++;*.cc;*.C;
|
||||||
|
H++=*.hpp;*.h;*.hxx;*.h++;*.hh;
|
||||||
C#=*.cs;*.vala;
|
C#=*.cs;*.vala;
|
||||||
CAML=*.ml;*.mli;
|
CAML=*.ml;*.mli;
|
||||||
D=*.d;*.di;
|
D=*.d;*.di;
|
||||||
|
68
data/filetypes.h
Executable file
68
data/filetypes.h
Executable file
@ -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=
|
||||||
|
|
||||||
|
|
67
data/filetypes.hpp
Executable file
67
data/filetypes.hpp
Executable file
@ -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=
|
||||||
|
|
@ -84,7 +84,18 @@ static void init_builtin_filetypes(void)
|
|||||||
ft->name = g_strdup("C");
|
ft->name = g_strdup("C");
|
||||||
ft->title = g_strdup_printf(_("%s source file"), "C");
|
ft->title = g_strdup_printf(_("%s source file"), "C");
|
||||||
ft->extension = g_strdup("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_open = g_strdup("/*");
|
||||||
ft->comment_close = g_strdup("*/");
|
ft->comment_close = g_strdup("*/");
|
||||||
ft->group = GEANY_FILETYPE_GROUP_COMPILED;
|
ft->group = GEANY_FILETYPE_GROUP_COMPILED;
|
||||||
@ -96,7 +107,18 @@ static void init_builtin_filetypes(void)
|
|||||||
ft->title = g_strdup_printf(_("%s source file"), "C++");
|
ft->title = g_strdup_printf(_("%s source file"), "C++");
|
||||||
ft->extension = g_strdup("cpp");
|
ft->extension = g_strdup("cpp");
|
||||||
ft->pattern = utils_strv_new("*.cpp", "*.cxx", "*.c++", "*.cc",
|
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_open = g_strdup("//");
|
||||||
ft->comment_close = NULL;
|
ft->comment_close = NULL;
|
||||||
ft->group = GEANY_FILETYPE_GROUP_COMPILED;
|
ft->group = GEANY_FILETYPE_GROUP_COMPILED;
|
||||||
@ -767,6 +789,7 @@ static GeanyFiletype *filetypes_detect_from_file_internal(const gchar *utf8_file
|
|||||||
const gchar *line)
|
const gchar *line)
|
||||||
{
|
{
|
||||||
GeanyFiletype *ft;
|
GeanyFiletype *ft;
|
||||||
|
filetype_id id;
|
||||||
|
|
||||||
/* try to find a shebang and if found use it prior to the filename extension
|
/* try to find a shebang and if found use it prior to the filename extension
|
||||||
* also checks for <?xml */
|
* also checks for <?xml */
|
||||||
@ -775,9 +798,16 @@ static GeanyFiletype *filetypes_detect_from_file_internal(const gchar *utf8_file
|
|||||||
return ft;
|
return ft;
|
||||||
|
|
||||||
if (utf8_filename == NULL)
|
if (utf8_filename == NULL)
|
||||||
return filetypes[GEANY_FILETYPES_NONE];
|
ft = filetypes[GEANY_FILETYPES_NONE];
|
||||||
|
else
|
||||||
return filetypes_detect_from_extension(utf8_filename);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef GEANY_FILETYPES_H
|
#ifndef HAVE_GEANY_FILETYPES_H
|
||||||
#define GEANY_FILETYPES_H 1
|
#define HAVE_GEANY_FILETYPES_H 1
|
||||||
|
|
||||||
#include "Scintilla.h"
|
#include "Scintilla.h"
|
||||||
#include "ScintillaWidget.h"
|
#include "ScintillaWidget.h"
|
||||||
@ -38,7 +38,9 @@ typedef enum
|
|||||||
/* normally compiled languages */
|
/* normally compiled languages */
|
||||||
GEANY_FILETYPES_ASM = 0,
|
GEANY_FILETYPES_ASM = 0,
|
||||||
GEANY_FILETYPES_C,
|
GEANY_FILETYPES_C,
|
||||||
|
GEANY_FILETYPES_H,
|
||||||
GEANY_FILETYPES_CPP,
|
GEANY_FILETYPES_CPP,
|
||||||
|
GEANY_FILETYPES_HPP,
|
||||||
GEANY_FILETYPES_CS,
|
GEANY_FILETYPES_CS,
|
||||||
GEANY_FILETYPES_CAML,
|
GEANY_FILETYPES_CAML,
|
||||||
GEANY_FILETYPES_D,
|
GEANY_FILETYPES_D,
|
||||||
|
@ -3063,9 +3063,11 @@ void highlighting_init_styles(gint filetype_idx, GKeyFile *config, GKeyFile *con
|
|||||||
init_styleset_case(GEANY_FILETYPES_ASM, asm);
|
init_styleset_case(GEANY_FILETYPES_ASM, asm);
|
||||||
init_styleset_case(GEANY_FILETYPES_BASIC, basic);
|
init_styleset_case(GEANY_FILETYPES_BASIC, basic);
|
||||||
init_styleset_case(GEANY_FILETYPES_C, c);
|
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_CAML, caml);
|
||||||
init_styleset_case(GEANY_FILETYPES_CONF, conf);
|
init_styleset_case(GEANY_FILETYPES_CONF, conf);
|
||||||
init_styleset_case(GEANY_FILETYPES_CPP, cpp);
|
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_CS, cs);
|
||||||
init_styleset_case(GEANY_FILETYPES_CSS, css);
|
init_styleset_case(GEANY_FILETYPES_CSS, css);
|
||||||
init_styleset_case(GEANY_FILETYPES_D, d);
|
init_styleset_case(GEANY_FILETYPES_D, d);
|
||||||
@ -3119,9 +3121,11 @@ void highlighting_set_styles(ScintillaObject *sci, gint filetype_idx)
|
|||||||
styleset_case(GEANY_FILETYPES_ASM, asm);
|
styleset_case(GEANY_FILETYPES_ASM, asm);
|
||||||
styleset_case(GEANY_FILETYPES_BASIC, basic);
|
styleset_case(GEANY_FILETYPES_BASIC, basic);
|
||||||
styleset_case(GEANY_FILETYPES_C, c);
|
styleset_case(GEANY_FILETYPES_C, c);
|
||||||
|
styleset_case(GEANY_FILETYPES_H, c);
|
||||||
styleset_case(GEANY_FILETYPES_CAML, caml);
|
styleset_case(GEANY_FILETYPES_CAML, caml);
|
||||||
styleset_case(GEANY_FILETYPES_CONF, conf);
|
styleset_case(GEANY_FILETYPES_CONF, conf);
|
||||||
styleset_case(GEANY_FILETYPES_CPP, cpp);
|
styleset_case(GEANY_FILETYPES_CPP, cpp);
|
||||||
|
styleset_case(GEANY_FILETYPES_HPP, cpp);
|
||||||
styleset_case(GEANY_FILETYPES_CS, cs);
|
styleset_case(GEANY_FILETYPES_CS, cs);
|
||||||
styleset_case(GEANY_FILETYPES_CSS, css);
|
styleset_case(GEANY_FILETYPES_CSS, css);
|
||||||
styleset_case(GEANY_FILETYPES_D, d);
|
styleset_case(GEANY_FILETYPES_D, d);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user