geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

filetypes.h File Reference

Filetype detection, file extensions and filetype menu items. More...

#include "geany.h"
#include "tm_parser.h"
#include "gtkcompat.h"
#include "Scintilla.h"
#include "ScintillaWidget.h"
#include <glib.h>
Include dependency graph for filetypes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GeanyFiletype
 Represents a filetype. More...
 

Macros

#define FILETYPE_ID(filetype_ptr)    (((filetype_ptr) != NULL) ? (filetype_ptr)->id : GEANY_FILETYPES_NONE)
 
#define filetypes   ((GeanyFiletype **)GEANY(filetypes_array)->pdata)
 Wraps GeanyData::filetypes_array so it can be used with C array syntax. More...
 
#define GEANY_TYPE_FILETYPE   (filetype_get_type())
 

Typedefs

typedef GeanyFiletypeID filetype_id
 
typedef struct GeanyFiletype GeanyFiletype
 Represents a filetype. More...
 

Enumerations

enum  GeanyFiletypeID {
  GEANY_FILETYPES_NONE = 0 , GEANY_FILETYPES_PHP , GEANY_FILETYPES_BASIC , GEANY_FILETYPES_MATLAB ,
  GEANY_FILETYPES_RUBY , GEANY_FILETYPES_LUA , GEANY_FILETYPES_FERITE , GEANY_FILETYPES_YAML ,
  GEANY_FILETYPES_C , GEANY_FILETYPES_NSIS , GEANY_FILETYPES_GLSL , GEANY_FILETYPES_PO ,
  GEANY_FILETYPES_MAKE , GEANY_FILETYPES_TCL , GEANY_FILETYPES_XML , GEANY_FILETYPES_CSS ,
  GEANY_FILETYPES_REST , GEANY_FILETYPES_HASKELL , GEANY_FILETYPES_JAVA , GEANY_FILETYPES_CAML ,
  GEANY_FILETYPES_AS , GEANY_FILETYPES_R , GEANY_FILETYPES_DIFF , GEANY_FILETYPES_HTML ,
  GEANY_FILETYPES_PYTHON , GEANY_FILETYPES_CS , GEANY_FILETYPES_PERL , GEANY_FILETYPES_VALA ,
  GEANY_FILETYPES_PASCAL , GEANY_FILETYPES_LATEX , GEANY_FILETYPES_ASM , GEANY_FILETYPES_CONF ,
  GEANY_FILETYPES_HAXE , GEANY_FILETYPES_CPP , GEANY_FILETYPES_SH , GEANY_FILETYPES_FORTRAN ,
  GEANY_FILETYPES_SQL , GEANY_FILETYPES_F77 , GEANY_FILETYPES_DOCBOOK , GEANY_FILETYPES_D ,
  GEANY_FILETYPES_JS , GEANY_FILETYPES_VHDL , GEANY_FILETYPES_ADA , GEANY_FILETYPES_CMAKE ,
  GEANY_FILETYPES_MARKDOWN , GEANY_FILETYPES_TXT2TAGS , GEANY_FILETYPES_ABC , GEANY_FILETYPES_VERILOG ,
  GEANY_FILETYPES_FORTH , GEANY_FILETYPES_LISP , GEANY_FILETYPES_ERLANG , GEANY_FILETYPES_COBOL ,
  GEANY_FILETYPES_OBJECTIVEC , GEANY_FILETYPES_ASCIIDOC , GEANY_FILETYPES_ABAQUS , GEANY_FILETYPES_BATCH ,
  GEANY_FILETYPES_POWERSHELL , GEANY_FILETYPES_RUST , GEANY_FILETYPES_COFFEESCRIPT , GEANY_FILETYPES_GO ,
  GEANY_FILETYPES_ZEPHIR , GEANY_FILETYPES_BIBTEX , GEANY_FILETYPES_SMALLTALK , GEANY_FILETYPES_JULIA ,
  GEANY_MAX_BUILT_IN_FILETYPES
}
 IDs of known filetypes. More...
 
enum  GeanyFiletypeGroupID {
  GEANY_FILETYPE_GROUP_NONE , GEANY_FILETYPE_GROUP_COMPILED , GEANY_FILETYPE_GROUP_SCRIPT , GEANY_FILETYPE_GROUP_MARKUP ,
  GEANY_FILETYPE_GROUP_MISC , GEANY_FILETYPE_GROUP_COUNT
}
 

Functions

GeanyFiletypefiletypes_detect_from_file (const gchar *utf8_filename)
 Detects filetype based on a shebang line in the file or the filename extension. More...
 
GeanyFiletypefiletypes_lookup_by_name (const gchar *name)
 Finds a filetype pointer from its name field. More...
 
GeanyFiletypefiletypes_index (gint idx)
 Accessor function for GeanyData::filetypes_array items. More...
 
const gchar * filetypes_get_display_name (GeanyFiletype *ft)
 Gets ft->name or a translation for filetype None. More...
 
const GSList * filetypes_get_sorted_by_name (void)
 Gets a list of filetype pointers sorted by name. More...
 
GType filetype_get_type (void)
 

Detailed Description

Filetype detection, file extensions and filetype menu items.

Definition in file filetypes.h.

Macro Definition Documentation

◆ FILETYPE_ID

#define FILETYPE_ID (   filetype_ptr)     (((filetype_ptr) != NULL) ? (filetype_ptr)->id : GEANY_FILETYPES_NONE)

Definition at line 139 of file filetypes.h.

◆ filetypes

#define filetypes   ((GeanyFiletype **)GEANY(filetypes_array)->pdata)

Wraps GeanyData::filetypes_array so it can be used with C array syntax.

Example: filetypes[GEANY_FILETYPES_C]->name = ...;

See also
filetypes_index().

Definition at line 178 of file filetypes.h.

◆ GEANY_TYPE_FILETYPE

#define GEANY_TYPE_FILETYPE   (filetype_get_type())

Definition at line 191 of file filetypes.h.

Typedef Documentation

◆ filetype_id

Definition at line 118 of file filetypes.h.

◆ GeanyFiletype

typedef struct GeanyFiletype GeanyFiletype

Represents a filetype.

Enumeration Type Documentation

◆ GeanyFiletypeGroupID

Enumerator
GEANY_FILETYPE_GROUP_NONE 
GEANY_FILETYPE_GROUP_COMPILED 
GEANY_FILETYPE_GROUP_SCRIPT 
GEANY_FILETYPE_GROUP_MARKUP 
GEANY_FILETYPE_GROUP_MISC 
GEANY_FILETYPE_GROUP_COUNT 

Definition at line 125 of file filetypes.h.

◆ GeanyFiletypeID

IDs of known filetypes.

filetypes will contain an item for each. Use GeanyData::filetypes_array to determine the known filetypes at runtime

Enumerator
GEANY_FILETYPES_NONE 
GEANY_FILETYPES_PHP 
GEANY_FILETYPES_BASIC 
GEANY_FILETYPES_MATLAB 
GEANY_FILETYPES_RUBY 
GEANY_FILETYPES_LUA 
GEANY_FILETYPES_FERITE 
GEANY_FILETYPES_YAML 
GEANY_FILETYPES_C 
GEANY_FILETYPES_NSIS 
GEANY_FILETYPES_GLSL 
GEANY_FILETYPES_PO 
GEANY_FILETYPES_MAKE 
GEANY_FILETYPES_TCL 
GEANY_FILETYPES_XML 
GEANY_FILETYPES_CSS 
GEANY_FILETYPES_REST 
GEANY_FILETYPES_HASKELL 
GEANY_FILETYPES_JAVA 
GEANY_FILETYPES_CAML 
GEANY_FILETYPES_AS 
GEANY_FILETYPES_R 
GEANY_FILETYPES_DIFF 
GEANY_FILETYPES_HTML 
GEANY_FILETYPES_PYTHON 
GEANY_FILETYPES_CS 
GEANY_FILETYPES_PERL 
GEANY_FILETYPES_VALA 
GEANY_FILETYPES_PASCAL 
GEANY_FILETYPES_LATEX 
GEANY_FILETYPES_ASM 
GEANY_FILETYPES_CONF 
GEANY_FILETYPES_HAXE 
GEANY_FILETYPES_CPP 
GEANY_FILETYPES_SH 
GEANY_FILETYPES_FORTRAN 
GEANY_FILETYPES_SQL 
GEANY_FILETYPES_F77 
GEANY_FILETYPES_DOCBOOK 
GEANY_FILETYPES_D 
GEANY_FILETYPES_JS 
GEANY_FILETYPES_VHDL 
GEANY_FILETYPES_ADA 
GEANY_FILETYPES_CMAKE 
GEANY_FILETYPES_MARKDOWN 
GEANY_FILETYPES_TXT2TAGS 
GEANY_FILETYPES_ABC 
GEANY_FILETYPES_VERILOG 
GEANY_FILETYPES_FORTH 
GEANY_FILETYPES_LISP 
GEANY_FILETYPES_ERLANG 
GEANY_FILETYPES_COBOL 
GEANY_FILETYPES_OBJECTIVEC 
GEANY_FILETYPES_ASCIIDOC 
GEANY_FILETYPES_ABAQUS 
GEANY_FILETYPES_BATCH 
GEANY_FILETYPES_POWERSHELL 
GEANY_FILETYPES_RUST 
GEANY_FILETYPES_COFFEESCRIPT 
GEANY_FILETYPES_GO 
GEANY_FILETYPES_ZEPHIR 
GEANY_FILETYPES_BIBTEX 
GEANY_FILETYPES_SMALLTALK 
GEANY_FILETYPES_JULIA 
GEANY_MAX_BUILT_IN_FILETYPES 

Definition at line 44 of file filetypes.h.

Function Documentation

◆ filetype_get_type()

GType filetype_get_type ( void  )

◆ filetypes_detect_from_file()

GeanyFiletype * filetypes_detect_from_file ( const gchar *  utf8_filename)

Detects filetype based on a shebang line in the file or the filename extension.

Parameters
utf8_filenameThe filename in UTF-8 encoding.
Returns
(transfer: none) The detected filetype for utf8_filename or filetypes[GEANY_FILETYPES_NONE] if it could not be detected.

Definition at line 759 of file filetypes.c.

References filetypes_detect_from_extension(), filetypes_detect_from_file_internal(), line, lines, NULL, and utils_get_locale_from_utf8().

◆ filetypes_get_display_name()

const gchar * filetypes_get_display_name ( GeanyFiletype ft)

Gets ft->name or a translation for filetype None.

Parameters
ft.
Returns
.
Since
Geany 0.20

Definition at line 1527 of file filetypes.c.

References _, GEANY_FILETYPES_NONE, GeanyFiletype::id, and GeanyFiletype::name.

Referenced by compile_regex(), create_statusbar_statistics(), and symbols_show_load_tags_dialog().

◆ filetypes_get_sorted_by_name()

const GSList * filetypes_get_sorted_by_name ( void  )

Gets a list of filetype pointers sorted by name.

The list does not change on subsequent calls.

Returns
(element-type: GeanyFiletype) (transfer: none) The list - do not free.
See also
filetypes_by_title.

Definition at line 234 of file filetypes.c.

References cmp_filetype(), filetypes_by_title, list, and NULL.

Referenced by plugin_configure(), and print_filetypes().

◆ filetypes_index()

GeanyFiletype * filetypes_index ( gint  idx)

Accessor function for GeanyData::filetypes_array items.

Example:

@ GEANY_FILETYPES_C
Definition: filetypes.h:55
GeanyFiletype * filetypes_index(gint idx)
Accessor function for GeanyData::filetypes_array items.
Definition: filetypes.c:1489
Parameters
idxfiletypes_array index.
Returns
(transfer: none) The filetype, or NULL if idx is out of range.
Since
0.16

Definition at line 1489 of file filetypes.c.

References filetypes, filetypes_array, and NULL.

Referenced by autocomplete_check_html(), make_comment_block(), and open_file_dialog_handle_response().

◆ filetypes_lookup_by_name()

GeanyFiletype * filetypes_lookup_by_name ( const gchar *  name)

Finds a filetype pointer from its name field.

Parameters
nameFiletype name.
Returns
(transfer: none) The filetype found, or NULL.
Since
0.15

Definition at line 1242 of file filetypes.c.

References EMPTY, filetypes_hash, geany_debug(), name, and NULL.

Referenced by build_load_menu(), copy_ft_groups(), filetypes_detect_from_file_internal(), instantsave_document_new_cb(), load_settings(), open_session_file(), and read_group().