FreeBasic: Update keywords
[geany-mirror.git] / HACKING
blob9a5759be6b57489310e59f1ce56e892f8cac3736
1 =============
2 Hacking Geany
3 =============
4 .. contents::
6 General
7 =======
9 About this file
10 ---------------
11 This file contains information for anyone wanting to work on the Geany
12 codebase. You should be aware of the open source licenses used - see
13 the README file or the documentation. It is reStructuredText; the
14 source file is HACKING. You can generate hacking.html by running ``make
15 hacking-doc`` from the doc/ subdirectory.
17 Writing plugins
18 ---------------
19 * src/plugindata.h contains the plugin API data types.
20 * See plugins/demoplugin.c for a very basic example plugin.
21 * src/plugins.c loads and unloads plugins (you shouldn't need to read
22   this really).
23 * The API documentation contains a few basic guidelines and hints to
24   write plugins.
26 You should generate and read the plugin API documentation, see below.
28 Plugin API documentation
29 ^^^^^^^^^^^^^^^^^^^^^^^^
30 You can generate documentation for the plugin API using the doxygen
31 tool. Run ``make api-doc`` in the doc subdirectory. The documentation
32 will be output to doc/reference/index.html.
33 Alternatively you can view the API documentation online at
34 http://www.geany.org/manual/reference/.
36 Pull requests
37 -------------
38 Making pull requests on Github is the preferred way of contributing for geany.
40 .. note:: For helping you to get started: https://help.github.com/articles/fork-a-repo
42 See `Rules to contribute`_ for more information.
44 Patches
45 -------
46 We are happy to receive patches, but the prefered way is to make a pull
47 request on our Github repository. If you don't want to make a pull request,
48 you can send your patches on the devel mailing list, but the rules are the same:
49 see `Rules to contribute`_ for more information.
51 In general it's best to provide git-formatted patches made from the
52 current Git (see `Committing`_)::
54     $ git commit -a
55     $ git format-patch HEAD^
57 We also accept patches against other releases, but it's more work for us.
59 If you're not using Git, although you're strongly suggested to used it,
60 you can use the diff command::
62     $ diff -u originalpath modifiedpath > new-feature.patch
64 However, such a patch won't contain the authoring information nor the
65 patch's description.
67 .. note::
68     Please make sure patches follow the style of existing code - In
69     particular, use tabs for indentation. See `Coding`_.
71 Rules to contribute
72 -------------------
74 Keep in mind this is best to check with us by email on mailing list
75 whether a new feature is appropriate and whether someone is already
76 working on similar code.
78 Please, make sure contributions you make follow these rules:
80 * changes should be made in a dedicated branch for pull requests.
81 * only one feature should be in each pull request (or patch).
82 * pull requests (or patches) should not contain changes unrelated to the feature,
83   and commits should be sensible units of change.
84 * the submitter should squash together corrections that are part of
85   the development process, especially correcting your own mistakes.
86 * Please make sure your modifications follow the style of existing code:
87   see `Coding`_ for more information.
89 See `Committing`_ for more information.
91 Windows tools
92 -------------
93 * Git: http://git-scm.com/ and http://code.google.com/p/msysgit/
94 * diff, grep, etc: http://mingw.org/ or http://unxutils.sourceforge.net/
96 See also the 'Building on Windows' document on the website.
98 File organization
99 -----------------
100 callbacks.c is just for Glade callbacks.
101 Avoid adding code to geany.h if it will fit better elsewhere.
102 See the top of each ``src/*.c`` file for a brief description of what
103 it's for.
105 Plugin API code
106 ---------------
107 Please be aware that anything with a doc-comment (a comment with an
108 extra asterix: ``/**``) is something in the plugin API. Things like
109 enums and structs can usually still be appended to, ensuring that all
110 the existing elements stay in place - this will keep the ABI stable.
112 .. warning::
114     Some structs like GeanyCallback cannot be appended to without
115     breaking the ABI because they are used to declare structs by
116     plugins, not just for accessing struct members through a pointer.
117     Normally structs should never be allocated by plugins.
119 Keeping the plugin ABI stable
120 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
121 Before the 1.0 release series, the ABI can change when necessary, and
122 even the API can change. An ABI change just means that all plugins will
123 not load and they must be rebuilt. An API change means that some plugins
124 might not build correctly.
126 If you're reordering or changing existing elements of structs that are
127 used as part of the plugin API, you must increment GEANY_ABI_VERSION
128 in plugindata.h. This is usually not needed if you're just appending
129 fields to structs. The GEANY_API_VERSION value should be incremented
130 for any changes to the plugin API, including appending elements.
132 If you're in any doubt when making changes to plugin API code, just ask us.
134 Plugin API/ABI design
135 ^^^^^^^^^^^^^^^^^^^^^
136 You should not make plugins rely on the size of a struct. This means:
138 * Don't let plugins allocate any structs (stack or heap).
139 * Don't let plugins index any arrays of structs.
140 * Don't add any array fields to structs in case we want to change the
141   array size later.
143 Doc-comments
144 ^^^^^^^^^^^^
145 * The @file tag can go in the source .c file, but use the .h header name so
146   it appears normally in the generated documentation. See ui_utils.c for an
147   example.
148 * Function doc-comments should always go in the source file, not the
149   header, so they can be updated if/when the implementation changes.
151 Glade
152 -----
153 Add user-interface widgets to the Glade 3 file ``data/geany.glade``.
154 Callbacks for the user-interface should go in ``src/callbacks.c``.
156 GTK versions & API documentation
157 --------------------------------
158 Geany requires GTK >= 2.16 and GLib >= 2.20. API symbols from newer
159 GTK/GLib versions should be avoided or made optional to keep the source
160 code building on older systems.
162 The official GTK 2.16 API documentation may not be available online
163 anymore, so we put it on http://www.geany.org/manual/gtk/. There
164 is also a tarball with all available files for download and use with
165 devhelp.
167 Using the 2.16 API documentation of the GTK libs (including GLib, GDK
168 and Pango) has the advantages that you don't get confused by any
169 newer API additions and you don't have to take care about whether
170 you can use them or not.
172 Coding
173 ------
174 * Don't write long functions with a lot of variables and/or scopes - break
175   them down into smaller static functions where possible. This makes code
176   much easier to read and maintain.
177 * Use GLib types and functions - gint not int, g_free() not free().
178 * Your code should build against GLib 2.20 and GTK 2.16. At least for the
179   moment, we want to keep the minimum requirement for GTK at 2.16 (of
180   course, you can use the GTK_CHECK_VERSION macro to protect code using
181   later versions).
182 * Variables should be declared before statements. You can use
183   gcc's -Wdeclaration-after-statement to warn about this.
184 * Don't let variable names shadow outer variables - use gcc's -Wshadow
185   option.
186 * Do not use G_LIKELY or G_UNLIKELY (except in critical loops). These
187   add noise to the code with little real benefit.
189 Compiler options & warnings
190 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
191 Use ``CFLAGS='-Wfoo' ./configure`` or ``CFLAGS='-Wfoo' ./autogen.sh``
192 to set warning options (as well as anything else e.g. -g -O2).
194 * Enable warnings - for gcc use '-Wall -W' (and optionally
195   -Wno-unused-parameter to avoid unused parameter warnings in Glade
196   callbacks).
197 * You should try to write ISO C99 code for portability, so always
198   use C ``/* */`` comments and function_name(void) instead of
199   function_name(). This is for compatibility with various Unix-like
200   compilers. You should use -std=c99 to help check this.
202 .. tip::
203     Remember for gcc you need to enable optimization to get certain
204     warnings like uninitialized variables, but for debugging it's
205     better to have no optimization on.
207 Style
208 ^^^^^
209 * We use a tab width of 4 and indent completely with tabs not spaces.
210   Note the documentation files use (4) spaces instead, so you may want
211   to use the 'Detect from file' indent pref.
212 * Do not add whitespace at the end of lines, this adds to commit noise.
213   When editing with Geany set preference files->Strip trailing spaces
214   and tabs.
215 * Use the multiline comment ``/* */`` to comment small blocks of code,
216   functions descriptions or longer explanations of code, etc. The more
217   comments are in your code the better. (See also
218   ``scripts/fix-cxx-comments.pl`` in Git).
219 * Lines should not be longer than about 100 characters and after 100
220   characters the lines should be wrapped and indented once more to
221   show that the line is continued.
222 * We don't put spaces between function names and the opening brace for
223   argument lists.
224 * Variable declarations come first after an opening brace, then one
225   newline to separate declarations and code.
226 * 2-operand operators should have a space each side.
227 * Function bodies should have 2 blank newlines after them.
228 * Align braces together on separate lines.
229 * Don't put assignments in 'if/while/etc' expressions except for loops,
230   for example ``for (int i = 0; i < some_limit; i++)``.
231 * if statements without brace bodies should have the code on a separate
232   line, then a blank line afterwards.
233 * Use braces after if/while statements if the body uses another
234   if/while statement.
235 * Try to fit in with the existing code style.
237 .. note::
238     A few of the above can be done with the Git
239     ``scripts/fix-alignment.pl``, but it is quite dumb and it's much better
240     to write it correctly in the first place.
241     ``scripts/rstrip-whitespace.py`` just removes trailing whitespace.
244 .. below tabs should be used, but spaces are required for reST.
246 Example::
248     struct Bar;
250     typedef struct Foo  /* struct names normally are the same as typedef names */
251     {
252         gint    foo;    /* names are somewhat aligned visually */
253         gint    bar;    /* fields don't share the same line */
254         SomeLongTypeName baz; /* alignment is not strict */
255         gchar   *ptr;   /* pointer symbol must go next to variable name, not type */
256         Bar     public; /**< only plugin API fields have a doc-comment */
257     }
258     Foo;
261     gint some_func(void);
263     gint some_other_func(void);
266     /* optional function comment explains something important */
267     gint function_long_name(gchar arg1, <too many args to fit on this line>,
268             gchar argN)
269     {
270         /* variable declarations always go before code in each scope */
271         /* variable names should NOT be aligned at all */
272         gint foo, bar;  /* variables can go on the same line */
273         gint baz;       /* but often don't */
274         gchar *ptr;     /* pointer symbol must go next to variable name, not type */
275         gchar *another; /* pointers should normally go on separate lines */
277         /* Some long comment block
278          * taking several different
279          * lines to explain */
280         if (foo)
281         {
282             /* variables only used in one scope should normally be declared there */
283             gint dir = -1;
285             bar = foo;
286             if ((bar & (guint)dir) != 7)
287                 some_code(arg1, <too many args to fit on this line>,
288                     argN - 1, argN);
290             some_func();
291         }
292     }
295     /** Explains using doc-comments for plugin API functions.
296      * First line should be short and use the third person tense - 'explains',
297      * not 'explain'.
298      *
299      * @return Some number.
300      * @since 1.22. */
301     gint another_function(void)
302     {
303         ...
305 Header Includes
306 ---------------
308 In order to make including various headers in Geany more convenient, each
309 file should include what it uses. If there is a file named ``foo.c``, and a
310 file named ``foo.h``, it should be possible to include ``foo.h`` on its own
311 without depending on stuff in ``foo.c`` that is included for the first time
312 before ``foo.h``.
314 Private Headers
315 ^^^^^^^^^^^^^^^
317 If there is some data that needs to be shared between various parts of the
318 core code, put them in a "private header", that is, if the public header is
319 called ``foo.h``, then make a ``fooprivate.h`` header that contains the
320 non-public functions, types, globals, etc that are needed. Other core source
321 files can then just include the ``foo.h`` and/or ``fooprivate.h`` depending
322 what they need, without exposing that stuff to plugins.
324 Order of Includes
325 ^^^^^^^^^^^^^^^^^
327 Inside a source file the includes section should be ordered like this:
329 1. Always include the ``config.h`` file at the start of every source file,
330    for example::
332     #ifdef HAVE_CONFIG_H
333     # include "config.h"
334     #endif
336    This allows the Autotools and other build systems use the ``./configure``
337    time settings. If you don't do this, there's likely to be a number of
338    macros that you'll have to define in the build system or custom headers.
340    Warning: Never include ``config.h`` in headers, and especially in "public"
341    headers that plugins might include.
343 2. Then include the header that has the same name as the source file (if
344    applicable). For example, for a source file named ``foo.c``, include
345    the ``foo.h`` below the ``config.h`` include. If there is a
346    ``fooprivate.h``, ``foo.c`` will most likely want to include that too,
347    put it in with includes in #3.
349 3. At this point, it should be safe to include all the headers that declare
350    whatever is needed. If everything generally "includes what it uses" and
351    all files included contain the appropriate multiple-declaration guards
352    then the order of includes is fairly arbitrary. Prefer to use English
353    alphabetic order if possible.
355 4. By now it doesn't really matter about the order, nothing below here is
356    "our problem". Semi-arbitrarily, you should use an include order like this:
358     1. Standard C headers
359     2. Non-standard system headers (eg. ``windows.h`` or ``unistd.h``)
360     3. GLib/GTK+ or related headers
362 5. Everything else that should not influence 1-4.
364 Including in Header Files
365 ^^^^^^^^^^^^^^^^^^^^^^^^^
367 Headers should also include what they use. All of the types should defined in
368 order to allow the header to be included stand-alone. For example, if a
369 header uses a ``GtkWidget*``, it should ``#include <gtk/gtk.h>``. Or, if a
370 headers uses a ``GPtrArray*``, it should ``#include <glib.h>`` to ensure that
371 all of the types are declared, whether by pointers/opaquely or fully, as
372 required. Since all headers will use a ``G_BEGIN_DECLS`` and ``G_END_DECLS``
373 guard for C++, the bare minimum for a header is to include ``glib.h`` or
374 ``<gtk/gtk.h>`` or ``gtkcompat.h`` or some other header that makes those
375 macros available.
378 Committing
379 ----------
381 * Commit one thing at a time, do small commits.  Commits should be
382   meaningful and not too big when possible; multiple small commits are
383   good if there is no good reason to group them.
384 * Use meaningful name and email in the Author and Committer fields.
385   This helps knowing who did what and allows to contact the author if
386   there is a good reason to do so (unlikely, but can happen).
387 * When working on a new feature, create a new branch for it.  When
388   merging it, use the --no-ff option to make sure a merge commit will
389   be created to better track what happened.  However, if the feature
390   only took one commit you might merge it fast-forward since there is
391   not history to keep together.
393 Commit messages
394 ^^^^^^^^^^^^^^^
395 Follow the standard Git formatting:
397 * No line should use more than about 80 characters (around 72 is best).
398 * The first line is the commit's summary and is followed by an empty
399   line.  This summary should be one line and one line only, thus less
400   than 80 characters.  This summary should not include any punctuation
401   unless really needed.  See it as the subject of an email: keep it
402   concise and as precise as you can, but not tool long.
403 * Following lines are optional detailed commit information, with
404   paragraphs separated by blank lines.  This part should be as long as
405   needed to describe the commit in depth, should use proper
406   punctuation and should include any useful information, like the
407   motivation for the patch and/or any valuable details the diff itself
408   don't provide or don't make clear.  Make it as complete as you think
409   it makes sense, but don't include an information that is better
410   explained by the commit's diff.
412   It is OK to use ASCII formatting like bullet list using "*" or "-",
413   etc. if useful, but emphasis (bold, italic, underline) should be
414   avoided.
416 Example::
418     Ask the user if spawn fails in utils_open_browser()
420     Ask the user to configure a valid browser command if spawning it
421     fails rather than falling back to some arbitrary hardcoded defaults.
423     This avoid spawning an unexpected browser when the configured one is
424     wrong, and gives the user a chance to correctly fix the preference.
427 Testing
428 -------
429 * Run with ``-v`` to print any debug messages.
430 * You can use a second instance (``geany -i``).
431 * To check first-run behaviour, use an alternate config directory by
432   passing ``-c some_dir`` (but make sure the directory is clean first).
433 * For debugging tips, see `GDB`_.
435 Bugs to watch out for
436 ---------------------
437 * Forgetting to check *doc->is_valid* when looping through
438   *documents_array* - instead use *foreach_document()*.
439 * Inserting fields into structs in the plugin API instead of appending.
440 * Not breaking the plugin ABI when necessary.
441 * Using an idle callback that doesn't check main_status.quitting.
442 * Forgetting to call vStringTerminate in CTags code.
443 * Forgetting CRLF line endings on Windows.
444 * Not handling Tabs & Spaces indent mode.
446 Libraries
447 ---------
448 We try to use an unmodified version of Scintilla - any new lexers or
449 other changes should be passed on to the maintainers at
450 http://scintilla.org. We normally update to a new Scintilla release
451 shortly after one is made. See also scintilla/README.
453 Tagmanager was originally taken from Anjuta 1.2.2, and parts of it
454 (notably c.c) have been merged from later versions of Anjuta and
455 CTags. The independent Tagmanager library itself ceased development
456 before Geany was started. It's source code parsing is mostly taken from
457 Exuberant CTags (see http://ctags.sf.net). If appropriate it's good to
458 pass language parser changes back to the CTags project.
461 Notes
462 =====
463 Some of these notes below are brief (or maybe incomplete) - please
464 contact the geany-devel mailing list for more information.
466 Using pre-defined autotools values
467 ----------------------------------
468 When you are use macros supplied by the autotools like GEANY_PREFIX,
469 GEANY_LIBDIR, GEANY_DATADIR and GEANY_LOCALEDIR be aware that these
470 might not be static strings when Geany is configured with
471 --enable-binreloc. Then these macros will be replaced by function calls
472 (in src/prefix.h). So, don't use anything like
473 printf("Prefix: " GEANY_PREFIX); but instead use
474 printf("Prefix: %s", GEANY_PREFIX);
476 Adding a source file foo.[hc] in src/ or plugins/
477 -------------------------------------------------
478 * Add foo.c, foo.h to SRCS in path/Makefile.am.
479 * Add foo.o to OBJS in path/makefile.win32.
480 * Add path/foo.c to geany_sources in wscript.
481 * Add path/foo.c to po/POTFILES.in (for string translation).
483 Adding a filetype
484 -----------------
485 You can add a filetype without syntax highlighting or tag parsing, but
486 check to see if those features have been written in upstream projects
487 first (scintilla or ctags).
489 **Custom:**
491 If you want to reuse an existing lexer and/or tag parser, making a
492 custom filetype is probably easier - it doesn't require any
493 changes to the source code. Follow instructions in the manual:
494 http://geany.org/manual/geany.html#custom-filetypes. Don't forget to
495 update the ``[Groups]`` section in ``filetype_extensions.conf``.
497 .. warning::
498   You should use the newer `[build-menu]` section for default build
499   commands - the older `[build_settings]` may not work correctly for
500   custom filetypes.
502 **Built-in:**
504 * Add GEANY_FILETYPES_FOO to filetypes.h.
505 * Initialize GEANY_FILETYPES_FOO in init_builtin_filetypes() of
506   filetypes.c.
507 * Update data/filetype_extensions.conf.
509 The remaining notes relate mostly to built-in filetypes.
511 filetypes.* configuration file
512 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
513 All languages need a data/filetypes.foo configuration file. See
514 the "Filetype definition files" section in the manual and/or
515 data/filetypes.c for an example.
517 Programming languages should have:
519 * [keywords] if the lexer supports it.
520 * [settings] mostly for comment settings.
521 * [build-menu] (or [build_settings]) for commands to run.
523 For languages with a Scintilla lexer, there should be a [styling] section,
524 to correspond to the styles used in highlighting_styles_FOO[] in
525 highlightingmappings.h - see below.
527 Don't forget to add the newly created filetype file to data/Makefile.am.
529 Syntax highlighting
530 ^^^^^^^^^^^^^^^^^^^
531 It may be possible to use an existing Scintilla lexer in the scintilla/
532 subdirectory - if not, you will need to find (or write) one,
533 LexFoo.cxx. Try the official Scintilla project first.
535 .. warning::
536     We won't accept adding a lexer that conflicts with one in
537     Scintilla. All new lexers should be submitted back to the Scintilla
538     project to save duplication of work.
540 When adding a lexer, update:
542 * scintilla/Makefile.am
543 * scintilla/makefile.win32
544 * wscript
545 * scintilla/src/Catalogue.cxx - add a LINK_LEXER command *manually*
547 For syntax highlighting, you will need to edit highlighting.c and
548 highlightingmappings.h and add the following things:
550 1. In highlightingmappings.h:
552    a. define ``highlighting_lexer_FOO`` to the Scintilla lexer ID for
553       this filtype, e.g. ``SCLEX_CPP``.
554    b. define the ``highlighting_styles_FOO`` array that maps Scintilla
555       style states to style names in the configuration file.
556    c. define ``highlighting_keywords_FOO`` to ``EMPTY_KEYWORDS`` if the
557       filtype has no keywords, or as an ``HLKeyword`` array mapping
558       the Scintilla keyword IDs to names in the configuration file.
559    d. define ``highlighting_properties_FOO`` to ``EMPTY_PROPERTIES``, or
560       as an array of ``HLProperty`` if the filetype requires some lexer
561       properties to be set.  However, note that properties should
562       normally be set in the ``[lexer_properties]`` section of the
563       configuration file instead.
565    You may look at other filtype's definitions for some examples
566    (Ada, CSS or Diff being good examples).
568 2. In highlighting.c:
570    a. Add ``init_styleset_case(FOO);`` in ``highlighting_init_styles()``.
571    b. Add ``styleset_case(FOO);`` in ``highlighting_set_styles()``.
573 3. Write data/filetypes.foo configuration file [styling] section. See
574    the manual and see data/filetypes.d for a named style example.
576 .. note::
577     Please try to make your styles fit in with the other filetypes'
578     default colors, and to use named styles where possible (e.g.
579     "commentline=comment"). Filetypes that share a lexer should have
580     the same colors. If not using named styles, leave the background color
581     empty to match the default color.
583 Error message parsing
584 ^^^^^^^^^^^^^^^^^^^^^
585 New-style error message parsing is done with an extended GNU-style regex
586 stored in the filetypes.foo file - see the [build_settings] information
587 in the manual for details.
589 Old-style error message parsing is done in
590 msgwin_parse_compiler_error_line() of msgwindow.c - see the ParseData
591 typedef for more information.
593 Other features
594 ^^^^^^^^^^^^^^
595 If the lexer has comment styles, you should add them in
596 highlighting_is_comment_style(). You should also update
597 highlighting_is_string_style() for string/character styles. For now,
598 this prevents calltips and autocompletion when typing in a comment
599 (but it can still be forced by the user).
601 For brace indentation, update lexer_has_braces() in editor.c;
602 indentation after ':' is done from on_new_line_added().
604 If the Scintilla lexer supports user type keyword highlighting (e.g.
605 SCLEX_CPP), update document_update_tags() in document.c.
607 Adding a TagManager parser
608 ^^^^^^^^^^^^^^^^^^^^^^^^^^
609 This assumes the filetype for Geany already exists.
611 First write or find a CTags compatible parser, foo.c. Note that there
612 are some language patches for CTags at:
613 http://sf.net/projects/ctags - see the tracker.
615 (You can also try the Anjuta project's tagmanager codebase.)
617 .. note::
618     From Geany 1.22 GLib's GRegex engine is used instead of POSIX
619     regex, unlike CTags. It should be close enough to POSIX to work
620     OK.
621     We no longer support regex parsers with the "b" regex flag
622     option set and Geany will print debug warnings if it's used.
623     CTags supports it but doesn't currently (2011) include any
624     parsers that use it. It should be easy to convert to extended
625     regex syntax anyway.
627 Method
628 ``````
629 * Add foo.c to SRCS in Makefile.am.
630 * Add foo.o to OBJS in makefile.win32.
631 * Add path/foo.c to geany_sources in wscript.
632 * Add Foo to parsers.h
633 * Add TM_PARSER_FOO to tagmanager/src/tm_parser.h.  The list here must follow
634   exactly the order in parsers.h.
636 In foo.c:
637 Edit FooKinds 3rd column to match a s_tag_type_names string in tm_tag.c.
638 (You may want to make the symbols.c change before doing this).
640 In filetypes.c, init_builtin_filetypes():
641 Set the 2nd argument of the FT_INIT() macro for this filetype to FOO.
643 In symbols.c:
644 Unless your parser uses C-like tag type kinds, update
645 add_top_level_items() for foo, calling tag_list_add_groups(). See
646 get_tag_type_iter() for which tv_iters fields to use.
648 Tests
649 `````
650 The tag parser tests checks if the proper tags are emitted
651 for a given source. Tests for tag parsers consist of two files: the
652 source to parse, and the expected output. Tests are run using ``make
653 check``.
655 The source to parse should be in the file ``tests/ctags/mytest.ext``,
656 where ``mytest`` is the name you choose for your test, and ``ext`` is an
657 extension recognized by Geany as the language the test file is for.
658 This file should contain a snippet of the language to test for.
659 It can be either long or short, depending on what it tests.
661 The expected output should be in the file ``tests/ctags/mytest.ext.tags``
662 (which is the same name as the source, but with ``.tags`` appended), and
663 should be in the format generated by ``geany -g``. This file contains
664 the tag information expected to be generated from the corresponding
665 source file.
667 When you have these two files, you have to list your new test along the
668 other ones in the ``test_source`` variable in ``tests/ctags/Makefile.am``.
669 Please keep this list sorted alphabetically.
674 Stop on warnings
675 ^^^^^^^^^^^^^^^^
676 When a GLib or GTK warning is printed, often you want to get a
677 backtrace to find out what code caused them. You can do that with the
678 ``--g-fatal-warnings`` argument, which will abort Geany on the first
679 warning it receives.
681 But for ordinary testing, you don't always want your editor to abort
682 just because of a warning - use::
684     (gdb) b handler_log if level <= G_LOG_LEVEL_WARNING
687 Running with batch commands
688 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
689 Use::
691     $ gdb src/geany -x gdb-commands
693 Where ``gdb-commands`` is a file with the following lines::
695     set pagination off
696     b handler_log if level <= G_LOG_LEVEL_WARNING
697     r -v
700 Loading a plugin
701 ^^^^^^^^^^^^^^^^
702 This is useful so you can load plugins without installing them first.
703 Alternatively you can use a symlink in ~/.config/geany/plugins or
704 $prefix/lib/geany (where $prefix is /usr/local by default).
706 The gdb session below was run from the toplevel Geany source directory.
707 Start normally with e.g. "gdb src/geany".
708 Type 'r' to run.
709 Press Ctrl-C from the gdb window to interrupt program execution.
711 Example::
713     Program received signal SIGINT, Interrupt.
714     0x00d16402 in __kernel_vsyscall ()
715     (gdb) call plugin_new("./plugins/.libs/demoplugin.so")
716     ** INFO: Loaded:   ./plugins/.libs/demoplugin.so (Demo)
717     $1 = (Plugin *) 0x905a890
718     (gdb) c
719     Continuing.
721     Program received signal SIGINT, Interrupt.
722     0x00d16402 in __kernel_vsyscall ()
723     (gdb) call plugin_free(0x905a890)
724     ** INFO: Unloaded: ./plugins/.libs/demoplugin.so
725     (gdb) c
726     Continuing.
728 Building Plugins
729 ^^^^^^^^^^^^^^^^
731 The geany-plugins autotools script automatically detects the
732 installed system Geany and builds the plugins against that.
734 To use plugins with a development version of Geany built with
735 a different prefix, the plugins will need to be compiled against
736 that version if the ABI has changed.
738 To do this you need to specify both --prefix and --with-geany-libdir
739 to the plugin configure.  Normally the plugin prefix is the
740 same as the Geany prefix to keep plugins with the version of Geany
741 that they are compiled against, and with-geany-libdir is the Geany
742 prefix/lib.
744 Whilst it is possible for the plugin prefix to be different to
745 the prefix of the libdir (which is why there are two settings),
746 it is probably better to keep the version of Geany and its plugins
747 together.