~ubuntu-branches/ubuntu/natty/geany/natty

1.2.2 by Damián Viano
Import upstream version 0.15
1
=============
2
Hacking Geany
3
=============
4
.. contents::
5
6
General
7
=======
8
1.1.5 by Damián Viano
Import upstream version 0.12
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
1.2.2 by Damián Viano
Import upstream version 0.15
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.
1.1.5 by Damián Viano
Import upstream version 0.12
16
1.2.1 by Damián Viano
Import upstream version 0.14
17
Writing plugins
18
---------------
1.2.2 by Damián Viano
Import upstream version 0.15
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).
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
23
* The API documentation contains a few basic guidelines and hints to
24
  write plugins.
1.2.2 by Damián Viano
Import upstream version 0.15
25
1.2.1 by Damián Viano
Import upstream version 0.14
26
You should generate and read the plugin API documentation, see below.
27
28
Plugin API documentation
29
^^^^^^^^^^^^^^^^^^^^^^^^
30
You can generate documentation for the plugin API using the doxygen
1.2.2 by Damián Viano
Import upstream version 0.15
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/.
1.2.1 by Damián Viano
Import upstream version 0.14
35
1.1.4 by Damián Viano
Import upstream version 0.11
36
Patches
37
-------
1.1.5 by Damián Viano
Import upstream version 0.12
38
We are happy to receive patches, but it's best to check with us by email
39
or mailing list whether a new feature is appropriate, and whether someone
40
is already working on similar code.
1.1.4 by Damián Viano
Import upstream version 0.11
41
1.1.5 by Damián Viano
Import upstream version 0.12
42
In general it's best to work from the current SVN, but we accept patches
1.2.2 by Damián Viano
Import upstream version 0.15
43
against other releases::
44
1.4.3 by Damián Viano
Import upstream version 0.19
45
    $ svn diff > fix-some-bug.patch
1.2.2 by Damián Viano
Import upstream version 0.15
46
47
If you're not using SVN, you can use the diff command::
48
1.4.3 by Damián Viano
Import upstream version 0.19
49
    $ diff -u originalpath modifiedpath > new-feature.patch
1.2.2 by Damián Viano
Import upstream version 0.15
50
1.4.2 by Damián Viano
Import upstream version 0.18.1
51
.. note::
52
    Please make sure patches follow the style of existing code - In
53
    particular, use tabs for indentation. See `Coding`_.
54
55
Windows tools
56
-------------
57
* Subversion (SVN): http://subversion.tigris.org/
58
* diff, grep, etc: http://mingw.org/ or http://unxutils.sourceforge.net/
59
1.1.5 by Damián Viano
Import upstream version 0.12
60
See also the 'Building on Windows' document on the website.
61
1.1.4 by Damián Viano
Import upstream version 0.11
62
File organization
63
-----------------
1.1.6 by Gauvain Pocentek
Import upstream version 0.13
64
callbacks.c is just for Glade callbacks.
1.1.4 by Damián Viano
Import upstream version 0.11
65
Avoid adding code to geany.h if it will fit better elsewhere.
1.2.2 by Damián Viano
Import upstream version 0.15
66
See the top of each ``src/*.c`` file for a brief description of what
67
it's for.
1.1.4 by Damián Viano
Import upstream version 0.11
68
1.4.2 by Damián Viano
Import upstream version 0.18.1
69
Plugin API code
70
---------------
1.2.1 by Damián Viano
Import upstream version 0.14
71
Please be aware that anything with a doc-comment (a comment with an
1.2.2 by Damián Viano
Import upstream version 0.15
72
extra asterix: ``/**``) is something in the plugin API. Things like
73
enums and structs can usually still be appended to, ensuring that all
74
the existing elements stay in place - this will keep the ABI stable.
75
76
.. warning::
77
1.4.3 by Damián Viano
Import upstream version 0.19
78
    Some structs like GeanyCallback cannot be appended to without
79
    breaking the ABI because they are used to declare structs by
80
    plugins, not just for accessing struct members through a pointer.
81
    Normally structs should never be allocated by plugins.
1.2.1 by Damián Viano
Import upstream version 0.14
82
1.4.2 by Damián Viano
Import upstream version 0.18.1
83
Keeping the plugin ABI stable
84
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.2.1 by Damián Viano
Import upstream version 0.14
85
Before the 1.0 release series, the ABI can change when necessary, and
86
even the API can change. An ABI change just means that all plugins will
1.2.2 by Damián Viano
Import upstream version 0.15
87
not load and they must be rebuilt. An API change means that some plugins
1.2.1 by Damián Viano
Import upstream version 0.14
88
might not build correctly.
89
1.4.2 by Damián Viano
Import upstream version 0.18.1
90
If you're reordering or changing existing elements of structs that are
91
used as part of the plugin API, you must increment GEANY_ABI_VERSION
1.2.2 by Damián Viano
Import upstream version 0.15
92
in plugindata.h. This is usually not needed if you're just appending
93
fields to structs. The GEANY_API_VERSION value should be incremented
94
for any changes to the plugin API, including appending elements.
1.2.1 by Damián Viano
Import upstream version 0.14
95
96
If you're in any doubt when making changes to plugin API code, just ask us.
1.1.4 by Damián Viano
Import upstream version 0.11
97
1.4.2 by Damián Viano
Import upstream version 0.18.1
98
Plugin API/ABI design
99
^^^^^^^^^^^^^^^^^^^^^
100
You should not make plugins rely on the size of a struct. This means:
101
102
* Don't let plugins allocate any structs (stack or heap).
103
* Don't let plugins index any arrays of structs.
104
* Don't add any array fields to structs in case we want to change the
105
  array size later.
106
107
Doc-comments
108
^^^^^^^^^^^^
109
* The @file tag can go in the source .c file, but use the .h header name so
110
  it appears normally in the generated documentation. See ui_utils.c for an
111
  example.
112
* Function doc-comments should always go in the source file, not the
113
  header, so they can be updated if/when the implementation changes.
114
1.1.4 by Damián Viano
Import upstream version 0.11
115
Glade
116
-----
1.1.5 by Damián Viano
Import upstream version 0.12
117
Use the code generation features of Glade instead of editing interface.c
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
118
or support.c. Glade 2.12 is recommended as long as we support GTK+ 2.8,
119
because later versions of Glade are not 100% compatible with GTK+ 2.8
120
(e.g. they may use functions added in GTK+ 2.10).
1.1.5 by Damián Viano
Import upstream version 0.12
121
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
122
You can build Glade 2.12 and run the binary in place, without installing
1.1.5 by Damián Viano
Import upstream version 0.12
123
it - this should work fine even if you have another version of Glade
124
installed on the system.
1.1.4 by Damián Viano
Import upstream version 0.11
125
1.1.15 by Chow Loong Jin
Import upstream version 0.20
126
You can download Glade 2.12.2 here:
127
http://download.geany.org/glade-2.12.2.tar.gz
128
1.2.1 by Damián Viano
Import upstream version 0.14
129
GTK API documentation
130
---------------------
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
131
The official GTK 2.8 API documentation is not available online anymore,
1.2.2 by Damián Viano
Import upstream version 0.15
132
so we put them on http://www.geany.org/manual/gtk/.
1.2.1 by Damián Viano
Import upstream version 0.14
133
There is also a tarball with all available files for download and use
134
with devhelp.
135
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
136
Using the 2.8 API documentation of the GTK libs (including GLib, GDK and
1.2.1 by Damián Viano
Import upstream version 0.14
137
Pango) has the advantages that you don't get confused by any newer API
138
additions and you don't have to take care about whether you can use
139
them or not.
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
140
This is because Geany depends on GTK 2.8. API symbols from newer
1.2.1 by Damián Viano
Import upstream version 0.14
141
GTK/GLib versions should be avoided to keep the source code building
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
142
against GTK 2.8.
1.2.1 by Damián Viano
Import upstream version 0.14
143
1.1.4 by Damián Viano
Import upstream version 0.11
144
Coding
145
------
1.2.2 by Damián Viano
Import upstream version 0.15
146
* Don't write long functions with a lot of variables and/or scopes - break
147
  them down into smaller static functions where possible. This makes code
148
  much easier to read and maintain.
1.4.2 by Damián Viano
Import upstream version 0.18.1
149
* Use GLib types and functions - gint not int, g_free() not free().
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
150
* Your code should build against GLib 2.8 and GTK 2.8. At least for the
151
  moment, we want to keep the minimum requirement for GTK at 2.8 (of
1.2.2 by Damián Viano
Import upstream version 0.15
152
  course, you can use the GTK_CHECK_VERSION macro to protect code using
153
  later versions).
1.4.2 by Damián Viano
Import upstream version 0.18.1
154
* Variables should be declared before statements. You can use
155
  gcc's -Wdeclaration-after-statement to warn about this.
156
* Don't let variable names shadow outer variables - use gcc's -Wshadow
157
  option.
158
159
Compiler options & warnings
160
^^^^^^^^^^^^^^^^^^^^^^^^^^^
161
Use ``CFLAGS='-Wfoo' ./configure`` or ``CFLAGS='-Wfoo' ./autogen.sh``
162
to set warning options (as well as anything else e.g. -g -O2).
163
164
* Enable warnings - for gcc use '-Wall -W' (and optionally
165
  -Wno-unused-parameter to avoid unused parameter warnings in Glade
166
  callbacks).
167
* You should try to write ISO C90 code for portability, so always
1.2.2 by Damián Viano
Import upstream version 0.15
168
  use C ``/* */`` comments and function_name(void) instead of
1.4.2 by Damián Viano
Import upstream version 0.18.1
169
  function_name(). This is for compatibility with various Unix-like
170
  compilers. You should use -ansi to help check this.
1.1.4 by Damián Viano
Import upstream version 0.11
171
1.4.3 by Damián Viano
Import upstream version 0.19
172
.. tip::
173
    Remember for gcc you need to enable optimization to get certain
174
    warnings like uninitialized variables, but for debugging it's
175
    better to have no optimization on.
176
1.1.4 by Damián Viano
Import upstream version 0.11
177
Style
1.4.2 by Damián Viano
Import upstream version 0.18.1
178
^^^^^
1.2.2 by Damián Viano
Import upstream version 0.15
179
* We use a tab width of 4 and indent completely with tabs not spaces.
1.4.3 by Damián Viano
Import upstream version 0.19
180
  Note the documentation files use (4) spaces instead, so you may want
181
  to use the 'Detect from file' indent pref.
1.2.2 by Damián Viano
Import upstream version 0.15
182
* Use the multiline comment ``/* */`` to comment small blocks of code,
183
  functions descriptions or longer explanations of code, etc. C++ single
184
  line comments will cause portability issues. The more comments are in
1.4.2 by Damián Viano
Import upstream version 0.18.1
185
  your code the better. (See also ``scripts/fix-cxx-comments.pl`` in SVN).
1.2.2 by Damián Viano
Import upstream version 0.15
186
* Lines should not be longer than about 100 characters and after 100
1.4.2 by Damián Viano
Import upstream version 0.18.1
187
  characters the lines should be wrapped and indented once more to
188
  show that the line is continued.
1.2.2 by Damián Viano
Import upstream version 0.15
189
* We don't put spaces between function names and the opening brace for
190
  argument lists.
1.4.2 by Damián Viano
Import upstream version 0.18.1
191
* Variable declarations come first after an opening brace, then one
192
  newline to separate declarations and code.
193
* 2-operand operators should have a space each side.
194
* Function bodies should have 2 blank newlines after them.
195
* Align braces together on separate lines.
196
* Don't put assignments in 'if/while/etc' expressions.
197
* if statements without brace bodies should have the code on a separate
198
  line, then a blank line afterwards.
199
* Use braces after if/while statements if the body uses another
200
  if/while statement.
201
* Try to fit in with the existing code style.
202
203
.. note::
204
    A few of the above can be done with the SVN
205
    ``scripts/fix-alignment.pl``, but it is quite dumb and it's much better
206
    to write it correctly in the first place.
207
208
.. below tabs should be used, but spaces are required for reST.
209
210
Example::
211
212
    gint some_func(void);
213
214
215
    gint function_long_name(gchar arg1, <too many args to fit on this line>,
216
            gchar argN)
217
    {
1.4.3 by Damián Viano
Import upstream version 0.19
218
        /* variable declarations go before code in each scope */
219
        gint foo, bar;  /* variables can go on the same line */
220
        gchar *ptr;     /* pointer symbol must go next to variable name, not type */
221
        gchar *another; /* pointers should normally go on separate lines */
1.4.2 by Damián Viano
Import upstream version 0.18.1
222
1.4.3 by Damián Viano
Import upstream version 0.19
223
        /* Some long comment block
224
         * taking several different
225
         * lines to explain */
1.4.2 by Damián Viano
Import upstream version 0.18.1
226
        if (foo)
227
        {
228
            gint dir = -1;    /* -1 to search backwards */
229
230
            bar = foo;
1.4.3 by Damián Viano
Import upstream version 0.19
231
            if ((bar & (guint)dir) != 7)
1.4.2 by Damián Viano
Import upstream version 0.18.1
232
                some_code(arg1, <too many args to fit on this line>,
233
                    argN - 1, argN);
234
235
            some_func();
236
        }
237
    }
238
239
240
    gint another_function(void)
241
    {
242
        ...
243
1.1.4 by Damián Viano
Import upstream version 0.11
244
1.4.3 by Damián Viano
Import upstream version 0.19
245
Testing
246
-------
247
* Run with ``-v`` to print any debug messages.
248
* You can use a second instance (``geany -i``).
249
* To check first-run behaviour, use an alternate config directory by
250
  passing ``-c some_dir`` (but make sure the directory is clean first).
251
* For debugging tips, see `GDB`_.
252
1.1.15 by Chow Loong Jin
Import upstream version 0.20
253
Bugs to watch out for
254
---------------------
255
* Forgetting to check *doc->is_valid* when looping through
256
  *documents_array* - instead use *foreach_document()*.
257
* Inserting fields into structs in the plugin API instead of appending.
258
* Not breaking the plugin ABI when necessary.
259
* Using an idle callback that doesn't check main_status.quitting.
260
* Forgetting CRLF line endings on Windows.
261
* Not handling Tabs & Spaces indent mode.
262
1.1.4 by Damián Viano
Import upstream version 0.11
263
Libraries
264
---------
1.4.3 by Damián Viano
Import upstream version 0.19
265
We try to use an unmodified version of Scintilla - any new lexers or
266
other changes should be passed on to the maintainers at
267
http://scintilla.org. We normally update to a new Scintilla release
1.1.15 by Chow Loong Jin
Import upstream version 0.20
268
shortly after one is made. See also scintilla/README.
1.1.5 by Damián Viano
Import upstream version 0.12
269
270
Tagmanager was originally taken from Anjuta 1.2.2, and parts of it
271
(notably c.c) have been merged from later versions of Anjuta and
272
CTags. The independent Tagmanager library itself ceased development
273
before Geany was started. It's source code parsing is mostly taken from
1.4.3 by Damián Viano
Import upstream version 0.19
274
Exuberant CTags (see http://ctags.sf.net). If appropriate it's good to
275
pass language parser changes back to the CTags project.
1.1.5 by Damián Viano
Import upstream version 0.12
276
277
1.2.2 by Damián Viano
Import upstream version 0.15
278
Notes
1.1.5 by Damián Viano
Import upstream version 0.12
279
=====
280
Some of these notes below are brief (or maybe incomplete) - please
1.2.2 by Damián Viano
Import upstream version 0.15
281
contact the geany-devel mailing list for more information.
1.1.5 by Damián Viano
Import upstream version 0.12
282
1.1.6 by Gauvain Pocentek
Import upstream version 0.13
283
Using pre-defined autotools values
284
----------------------------------
285
When you are use macros supplied by the autotools like GEANY_PREFIX,
286
GEANY_LIBDIR, GEANY_DATADIR and GEANY_LOCALEDIR be aware that these
287
might not be static strings when Geany is configured with
288
--enable-binreloc. Then these macros will be replaced by function calls
289
(in src/prefix.h). So, don't use anything like
290
printf("Prefix: " GEANY_PREFIX); but instead use
291
printf("Prefix: %s", GEANY_PREFIX);
292
1.2.2 by Damián Viano
Import upstream version 0.15
293
Adding a source file foo.[hc] in src/ or plugins/
294
-------------------------------------------------
295
* Add foo.c, foo.h to SRCS in path/Makefile.am.
296
* Add foo.o to OBJS in path/makefile.win32.
1.4.2 by Damián Viano
Import upstream version 0.18.1
297
* Add path/foo.c to geany_sources in wscript.
1.2.2 by Damián Viano
Import upstream version 0.15
298
* Add path/foo.c to po/POTFILES.in (for string translation).
1.1.5 by Damián Viano
Import upstream version 0.12
299
300
Adding a filetype
301
-----------------
302
You can add a filetype without syntax highlighting or tag parsing, but
303
check to see if those features have been written in other projects first.
304
1.2.2 by Damián Viano
Import upstream version 0.15
305
* Add GEANY_FILETYPES_FOO to filetypes.h.
306
* Initialize GEANY_FILETYPES_FOO in init_builtin_filetypes() of
1.4.3 by Damián Viano
Import upstream version 0.19
307
  filetypes.c. You should use filetype_make_title() to avoid a
308
  translation whenever possible.
1.4.2 by Damián Viano
Import upstream version 0.18.1
309
* Update data/filetype_extensions.conf.
1.1.5 by Damián Viano
Import upstream version 0.12
310
1.2.2 by Damián Viano
Import upstream version 0.15
311
filetypes.* configuration file
312
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.1.6 by Gauvain Pocentek
Import upstream version 0.13
313
All languages need a data/filetypes.foo configuration file. See
1.4.1 by Damian Viano
Import upstream version 0.18
314
the "Filetype definition files" section in the manual and/or
1.2.2 by Damián Viano
Import upstream version 0.15
315
data/filetypes.c for an example.
1.1.5 by Damián Viano
Import upstream version 0.12
316
317
Programming languages should have:
1.2.2 by Damián Viano
Import upstream version 0.15
318
319
* [keywords] if the lexer supports it.
320
* [settings] mostly for comment settings.
321
* [build_settings] for commands to run.
322
323
For languages with a Scintilla lexer, there should be a [styling] section,
324
to correspond to the styles used in styleset_foo() in highlighting.c -
325
see below.
326
327
Syntax highlighting
328
^^^^^^^^^^^^^^^^^^^
329
It may be possible to use an existing Scintilla lexer in the scintilla/
330
subdirectory - if not, you will need to find (or write) one,
1.4.3 by Damián Viano
Import upstream version 0.19
331
LexFoo.cxx. Try the official Scintilla project first.
332
333
.. warning::
334
    We won't accept adding a lexer that conflicts with one in
335
    Scintilla. All new lexers should be submitted back to the Scintilla
336
    project to save duplication of work.
337
338
When adding a lexer, update:
1.2.2 by Damián Viano
Import upstream version 0.15
339
340
* scintilla/Makefile.am
341
* scintilla/makefile.win32
1.4.2 by Damián Viano
Import upstream version 0.18.1
342
* wscript
1.2.2 by Damián Viano
Import upstream version 0.15
343
* scintilla/KeyWords.cxx - add a LINK_LEXER command *manually*
1.1.5 by Damián Viano
Import upstream version 0.12
344
1.1.6 by Gauvain Pocentek
Import upstream version 0.13
345
For syntax highlighting, you will need to edit highlighting.c and add
346
the following things:
1.2.2 by Damián Viano
Import upstream version 0.15
347
1.4.3 by Damián Viano
Import upstream version 0.19
348
1. Write styleset_foo_init() to setup lexer styles and load style
1.2.2 by Damián Viano
Import upstream version 0.15
349
   settings from the filetypes.foo configuration file. You should probably
350
   start by copying and adapting another filetype's initialization, such
1.4.3 by Damián Viano
Import upstream version 0.19
351
   as styleset_tcl_init(). You may want to use load_style_entries().
1.1.6 by Gauvain Pocentek
Import upstream version 0.13
352
2. Write styleset_foo() to apply styles when a new scintilla widget
1.4.1 by Damian Viano
Import upstream version 0.18
353
   is created. Again you could copy and adapt a function like
1.4.3 by Damián Viano
Import upstream version 0.19
354
   styleset_tcl(). You may want to use apply_style_entries().
1.2.2 by Damián Viano
Import upstream version 0.15
355
3. In highlighting_init_styles(), add
1.4.1 by Damian Viano
Import upstream version 0.18
356
   ``init_styleset_case(GEANY_FILETYPES_FOO, styleset_foo_init);``.
1.2.2 by Damián Viano
Import upstream version 0.15
357
4. In highlighting_set_styles(), add
1.4.1 by Damian Viano
Import upstream version 0.18
358
   ``styleset_case(GEANY_FILETYPES_FOO, styleset_foo);``.
1.4.3 by Damián Viano
Import upstream version 0.19
359
5. Write data/filetypes.foo configuration file [styling] section. See
360
   the manual and see data/filetypes.d for a named style example.
361
362
.. note::
363
    Please try to make your styles fit in with the other filetypes'
364
    default colors, and to use named styles where possible (e.g.
365
    "commentline=comment"). Filetypes that share a lexer should have
366
    the same colors. If not using named styles, leave the background color
367
    empty to match the default color.
1.2.2 by Damián Viano
Import upstream version 0.15
368
369
Error message parsing
370
^^^^^^^^^^^^^^^^^^^^^
371
New-style error message parsing is done with an extended GNU-style regex
372
stored in the filetypes.foo file - see the [build_settings] information
373
in the manual for details.
374
375
Old-style error message parsing is done in
376
msgwin_parse_compiler_error_line() of msgwindow.c - see the ParseData
377
typedef for more information.
378
379
Other features
380
^^^^^^^^^^^^^^
1.1.15 by Chow Loong Jin
Import upstream version 0.20
381
If the lexer has comment styles, you should add them in
382
highlighting_is_comment_style(). You should also update
383
highlighting_is_string_style() for string/character styles. For now,
384
this prevents calltips and autocompletion when typing in a comment
385
(but it can still be forced by the user).
386
1.1.6 by Gauvain Pocentek
Import upstream version 0.13
387
For brace indentation, update lexer_has_braces() in editor.c;
388
indentation after ':' is done from on_new_line_added().
1.1.5 by Damián Viano
Import upstream version 0.12
389
1.2.2 by Damián Viano
Import upstream version 0.15
390
If the Scintilla lexer supports user type keyword highlighting (e.g.
391
SCLEX_CPP), update editor_lexer_get_type_keyword_idx() in editor.c.
1.1.5 by Damián Viano
Import upstream version 0.12
392
393
Adding a TagManager parser
1.2.2 by Damián Viano
Import upstream version 0.15
394
^^^^^^^^^^^^^^^^^^^^^^^^^^
395
This assumes the filetype for Geany already exists.
1.1.5 by Damián Viano
Import upstream version 0.12
396
397
First write or find a CTags compatible parser, foo.c. Note that there
398
are some language patches for CTags at:
399
http://sf.net/projects/ctags - see the tracker.
400
401
(You can also try the Anjuta project's tagmanager codebase.)
402
1.2.2 by Damián Viano
Import upstream version 0.15
403
* Add foo.c to SRCS in Makefile.am.
404
* Add foo.o to OBJS in makefile.win32.
1.4.2 by Damián Viano
Import upstream version 0.18.1
405
* Add path/foo.c to geany_sources in wscript.
1.2.2 by Damián Viano
Import upstream version 0.15
406
* Add Foo to parsers.h & fill in comment with parser number for foo.
1.1.5 by Damián Viano
Import upstream version 0.12
407
408
In foo.c:
409
Edit FooKinds 3rd column to match a s_tag_type_names string in tm_tag.c.
1.4.3 by Damián Viano
Import upstream version 0.19
410
(You may want to make the symbols.c change before doing this).
1.1.5 by Damián Viano
Import upstream version 0.12
411
1.2.2 by Damián Viano
Import upstream version 0.15
412
In filetypes.c, init_builtin_filetypes():
1.1.5 by Damián Viano
Import upstream version 0.12
413
Set filetypes[GEANY_FILETYPES_FOO].lang = foo's parser number.
414
415
In symbols.c:
1.4.3 by Damián Viano
Import upstream version 0.19
416
Unless your parser uses C-like tag type kinds, update
417
add_top_level_items() for foo, calling tag_list_add_groups(). See
418
get_tag_type_iter() for which tv_iters fields to use.
1.1.5 by Damián Viano
Import upstream version 0.12
419
420
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
421
GDB
422
---
423
424
Stop on warnings
425
^^^^^^^^^^^^^^^^
426
When a GLib or GTK warning is printed, often you want to get a
427
backtrace to find out what code caused them. You can do that with the
428
``--g-fatal-warnings`` argument, which will abort Geany on the first
429
warning it receives.
430
431
But for ordinary testing, you don't always want your editor to abort
432
just because of a warning - use::
433
434
    (gdb) b handler_log if level <= G_LOG_LEVEL_WARNING
435
436
437
Running with batch commands
438
^^^^^^^^^^^^^^^^^^^^^^^^^^^
439
Use::
440
441
    $ gdb src/geany -x gdb-commands
442
443
Where ``gdb-commands`` is a file with the following lines::
444
445
    set pagination off
446
    b handler_log if level <= G_LOG_LEVEL_WARNING
1.4.3 by Damián Viano
Import upstream version 0.19
447
    r -v
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
448
449
450
Loading a plugin
451
^^^^^^^^^^^^^^^^
1.1.5 by Damián Viano
Import upstream version 0.12
452
This is useful so you can load plugins without installing them first.
1.1.9 by Jérôme Guelfucci
Import upstream version 0.16
453
Alternatively you can use a symlink in ~/.config/geany/plugins or
1.1.5 by Damián Viano
Import upstream version 0.12
454
$prefix/lib/geany (where $prefix is /usr/local by default).
455
456
The gdb session below was run from the toplevel Geany source directory.
457
Start normally with e.g. "gdb src/geany".
458
Type 'r' to run.
459
Press Ctrl-C from the gdb window to interrupt program execution.
460
1.2.2 by Damián Viano
Import upstream version 0.15
461
Example::
462
1.4.3 by Damián Viano
Import upstream version 0.19
463
    Program received signal SIGINT, Interrupt.
464
    0x00d16402 in __kernel_vsyscall ()
465
    (gdb) call plugin_new("./plugins/.libs/demoplugin.so")
466
    ** INFO: Loaded:   ./plugins/.libs/demoplugin.so (Demo)
467
    $1 = (Plugin *) 0x905a890
468
    (gdb) c
469
    Continuing.
1.2.2 by Damián Viano
Import upstream version 0.15
470
1.4.3 by Damián Viano
Import upstream version 0.19
471
    Program received signal SIGINT, Interrupt.
472
    0x00d16402 in __kernel_vsyscall ()
473
    (gdb) call plugin_free(0x905a890)
474
    ** INFO: Unloaded: ./plugins/.libs/demoplugin.so
475
    (gdb) c
476
    Continuing.