Revision: 4571
http://geany.svn.sourceforge.net/geany/?rev=4571&view=rev
Author: ntrel
Date: 2010-01-28 13:10:44 +0000 (Thu, 28 Jan 2010)
Log Message:
-----------
Backport from trunk:
Add 'Compiler options & warnings' section.
Update Style section to be clearer about code alignment and show
some example code.
Other minor edits.
Modified Paths:
--------------
branches/geany-0.18.1/ChangeLog
branches/geany-0.18.1/HACKING
Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog 2010-01-28 13:06:19 UTC (rev 4570)
+++ branches/geany-0.18.1/ChangeLog 2010-01-28 13:10:44 UTC (rev 4571)
@@ -3,6 +3,11 @@
* src/keybindings.c:
Fix 'Reflow block' command when at the last paragraph and there's
no last newline (patch by Eugene Arshinov, thanks).
+ * HACKING:
+ Add 'Compiler options & warnings' section.
+ Update Style section to be clearer about code alignment and show
+ some example code.
+ Other minor edits.
2009-09-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: branches/geany-0.18.1/HACKING
===================================================================
--- branches/geany-0.18.1/HACKING 2010-01-28 13:06:19 UTC (rev 4570)
+++ branches/geany-0.18.1/HACKING 2010-01-28 13:10:44 UTC (rev 4571)
@@ -48,12 +48,15 @@
$ diff -u originalpath modifiedpath > new-feature.patch
-Please make sure patches follow the style of existing code - In
-particular, use tabs for indentation. See `Style`_ and `Coding`_.
+.. note::
+ Please make sure patches follow the style of existing code - In
+ particular, use tabs for indentation. See `Coding`_.
-For Windows:
-Subversion (SVN): http://subversion.tigris.org/
-diff, grep, etc: http://mingw.org/ or http://unxutils.sourceforge.net/.
+Windows tools
+-------------
+* Subversion (SVN): http://subversion.tigris.org/
+* diff, grep, etc: http://mingw.org/ or http://unxutils.sourceforge.net/
+
See also the 'Building on Windows' document on the website.
File organization
@@ -91,7 +94,7 @@
If you're in any doubt when making changes to plugin API code, just ask us.
Plugin API/ABI design
----------------------
+^^^^^^^^^^^^^^^^^^^^^
You should not make plugins rely on the size of a struct. This means:
* Don't let plugins allocate any structs (stack or heap).
@@ -130,36 +133,89 @@
* Don't write long functions with a lot of variables and/or scopes - break
them down into smaller static functions where possible. This makes code
much easier to read and maintain.
-* Use GLib types and functions - e.g. g_free instead of free.
+* Use GLib types and functions - gint not int, g_free() not free().
* Your code should build against GLib 2.8 and GTK 2.8. At least for the
moment, we want to keep the minimum requirement for GTK at 2.8 (of
course, you can use the GTK_CHECK_VERSION macro to protect code using
later versions).
-* We currently try to support the old GCC 2.9.x compiler,
- so we always declare variables before statements. You can use
- -Wdeclaration-after-statement in your ./configure CFLAGS to warn about
- this.
-* You should also try to write ISO C90 code for portability, so always
+* Variables should be declared before statements. You can use
+ gcc's -Wdeclaration-after-statement to warn about this.
+* Don't let variable names shadow outer variables - use gcc's -Wshadow
+ option.
+
+Compiler options & warnings
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Use ``CFLAGS='-Wfoo' ./configure`` or ``CFLAGS='-Wfoo' ./autogen.sh``
+to set warning options (as well as anything else e.g. -g -O2).
+
+* Enable warnings - for gcc use '-Wall -W' (and optionally
+ -Wno-unused-parameter to avoid unused parameter warnings in Glade
+ callbacks).
+* You should try to write ISO C90 code for portability, so always
use C ``/* */`` comments and function_name(void) instead of
- function_name(). This is for compatibility with various Unix-like
- compilers. You can use -ansi in your CFLAGS to help check this.
+ function_name(). This is for compatibility with various Unix-like
+ compilers. You should use -ansi to help check this.
Style
------
+^^^^^
* We use a tab width of 4 and indent completely with tabs not spaces.
* Use the multiline comment ``/* */`` to comment small blocks of code,
functions descriptions or longer explanations of code, etc. C++ single
line comments will cause portability issues. The more comments are in
- your code the better.
+ your code the better. (See also ``scripts/fix-cxx-comments.pl`` in SVN).
* Lines should not be longer than about 100 characters and after 100
- characters the lines should be wrapped and more indented than the first
- line to highlight that the line is continued.
+ characters the lines should be wrapped and indented once more to
+ show that the line is continued.
* We don't put spaces between function names and the opening brace for
argument lists.
-* Try to fit in with the existing code brace indenting style, comments,
- operator spacing etc. It's not required for patches but it will save
- us having to manually reformat them.
+* Variable declarations come first after an opening brace, then one
+ newline to separate declarations and code.
+* 2-operand operators should have a space each side.
+* Function bodies should have 2 blank newlines after them.
+* Align braces together on separate lines.
+* Don't put assignments in 'if/while/etc' expressions.
+* if statements without brace bodies should have the code on a separate
+ line, then a blank line afterwards.
+* Use braces after if/while statements if the body uses another
+ if/while statement.
+* Try to fit in with the existing code style.
+.. note::
+ A few of the above can be done with the SVN
+ ``scripts/fix-alignment.pl``, but it is quite dumb and it's much better
+ to write it correctly in the first place.
+
+.. below tabs should be used, but spaces are required for reST.
+
+Example::
+
+ gint some_func(void);
+
+
+ gint function_long_name(gchar arg1, <too many args to fit on this line>,
+ gchar argN)
+ {
+ gint foo;
+
+ if (foo)
+ {
+ gint dir = -1; /* -1 to search backwards */
+
+ bar = foo;
+ if (bar != 7)
+ some_code(arg1, <too many args to fit on this line>,
+ argN - 1, argN);
+
+ some_func();
+ }
+ }
+
+
+ gint another_function(void)
+ {
+ ...
+
+
Libraries
---------
We prefer to use an unmodified version of Scintilla - any changes should
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4570
http://geany.svn.sourceforge.net/geany/?rev=4570&view=rev
Author: ntrel
Date: 2010-01-28 13:06:19 +0000 (Thu, 28 Jan 2010)
Log Message:
-----------
Backport from trunk:
Fix 'Reflow block' command when at the last paragraph and there's
no last newline (patch by Eugene Arshinov, thanks).
Modified Paths:
--------------
branches/geany-0.18.1/ChangeLog
branches/geany-0.18.1/src/keybindings.c
Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog 2010-01-28 13:00:47 UTC (rev 4569)
+++ branches/geany-0.18.1/ChangeLog 2010-01-28 13:06:19 UTC (rev 4570)
@@ -1,3 +1,10 @@
+2009-09-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/keybindings.c:
+ Fix 'Reflow block' command when at the last paragraph and there's
+ no last newline (patch by Eugene Arshinov, thanks).
+
+
2009-09-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/plugins.c:
Modified: branches/geany-0.18.1/src/keybindings.c
===================================================================
--- branches/geany-0.18.1/src/keybindings.c 2010-01-28 13:00:47 UTC (rev 4569)
+++ branches/geany-0.18.1/src/keybindings.c 2010-01-28 13:06:19 UTC (rev 4570)
@@ -2087,8 +2087,12 @@
/* deselect last line break */
pos = sci_get_selection_end(sci);
line = sci_get_line_from_position(sci, pos);
- pos = sci_get_line_end_position(sci, line - 1);
- sci_set_selection_end(sci, pos);
+ if (line < sci_get_line_count(sci) - 1)
+ {
+ /* not last line */
+ pos = sci_get_line_end_position(sci, line - 1);
+ sci_set_selection_end(sci, pos);
+ }
}
split_lines(editor);
if (!sel)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4569
http://geany.svn.sourceforge.net/geany/?rev=4569&view=rev
Author: ntrel
Date: 2010-01-28 13:00:47 +0000 (Thu, 28 Jan 2010)
Log Message:
-----------
Backport from trunk:
Remove plugin from plugin manager dialog on unloading if it no
longer exists or is incompatible.
Modified Paths:
--------------
branches/geany-0.18.1/ChangeLog
branches/geany-0.18.1/src/plugins.c
Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog 2010-01-28 12:48:53 UTC (rev 4568)
+++ branches/geany-0.18.1/ChangeLog 2010-01-28 13:00:47 UTC (rev 4569)
@@ -1,3 +1,10 @@
+2009-09-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/plugins.c:
+ Remove plugin from plugin manager dialog on unloading if it no
+ longer exists or is incompatible.
+
+
2009-08-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/geany.h:
Modified: branches/geany-0.18.1/src/plugins.c
===================================================================
--- branches/geany-0.18.1/src/plugins.c 2010-01-28 12:48:53 UTC (rev 4568)
+++ branches/geany-0.18.1/src/plugins.c 2010-01-28 13:00:47 UTC (rev 4569)
@@ -1057,20 +1057,27 @@
/* reload plugin module and initialize it if item is checked */
p = plugin_new(file_name, state, TRUE);
- if (state)
- keybindings_load_keyfile(); /* load shortcuts */
+ if (!p)
+ {
+ /* plugin file may no longer be on disk, or is now incompatible */
+ gtk_list_store_remove(pm_widgets.store, &iter);
+ }
+ else
+ {
+ if (state)
+ keybindings_load_keyfile(); /* load shortcuts */
- /* update model */
- gtk_list_store_set(pm_widgets.store, &iter,
- PLUGIN_COLUMN_CHECK, state,
- PLUGIN_COLUMN_PLUGIN, p, -1);
+ /* update model */
+ gtk_list_store_set(pm_widgets.store, &iter,
+ PLUGIN_COLUMN_CHECK, state,
+ PLUGIN_COLUMN_PLUGIN, p, -1);
+ /* set again the sensitiveness of the configure and help buttons */
+ is_active = is_active_plugin(p);
+ gtk_widget_set_sensitive(pm_widgets.configure_button, p->configure != NULL && is_active);
+ gtk_widget_set_sensitive(pm_widgets.help_button, p->help != NULL && is_active);
+ }
g_free(file_name);
-
- /* set again the sensitiveness of the configure and help buttons */
- is_active = is_active_plugin(p);
- gtk_widget_set_sensitive(pm_widgets.configure_button, p->configure != NULL && is_active);
- gtk_widget_set_sensitive(pm_widgets.help_button, p->help != NULL && is_active);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4567
http://geany.svn.sourceforge.net/geany/?rev=4567&view=rev
Author: eht16
Date: 2010-01-25 21:17:04 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
Backport from trunk:
Mention Files link at top for header files; demoplugin.c.
Minor edits; remove 'far from being complete'.
Modified Paths:
--------------
branches/geany-0.18.1/ChangeLog
branches/geany-0.18.1/doc/plugins.dox
Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog 2010-01-25 21:16:55 UTC (rev 4566)
+++ branches/geany-0.18.1/ChangeLog 2010-01-25 21:17:04 UTC (rev 4567)
@@ -2,6 +2,9 @@
* src/geany.h:
Define G_GNUC_WARN_UNUSED_RESULT if GLib < 2.10.
+ * doc/plugins.dox:
+ Mention Files link at top for header files; demoplugin.c.
+ Minor edits; remove 'far from being complete'.
2009-08-26 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: branches/geany-0.18.1/doc/plugins.dox
===================================================================
--- branches/geany-0.18.1/doc/plugins.dox 2010-01-25 21:16:55 UTC (rev 4566)
+++ branches/geany-0.18.1/doc/plugins.dox 2010-01-25 21:17:04 UTC (rev 4567)
@@ -35,8 +35,7 @@
* @date $Date$
*
* @section Intro
- * This is the Geany API documentation. It is far from being complete and should be
- * considered as a work in progress.
+ * This is the Geany API documentation. It should be considered work in progress.
* We will try to document as many functions and structs as possible.
*
* To get started, see the @link howto Plugin Howto @endlink.
@@ -47,11 +46,13 @@
* - @link signals Plugin Signals @endlink
* - @link pluginutils.c Plugin Utility Functions @endlink
* - @link guidelines Plugin Writing Guidelines @endlink
+ * - <b>plugins/demoplugin.c</b> - in Geany's source, bigger than the howto example
+ * - Header files for functions and types - see <b>Files</b> link at the top
+ * - Deprecated symbols - see <b>Related Pages</b> link at the top
*
- * @note Some of these pages are also listed in Related Pages, plus the list of deprecated symbols.
- * @warning Do not use anything not documented here, it may change.
- * @note You should see the HACKING file for information about developing the plugin API and
- * other useful things.
+ * @warning Do not use any symbol not in the documentation - it may change.
+ * @note See the HACKING file for information about developing the plugin API and
+ * other useful notes.
*/
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4566
http://geany.svn.sourceforge.net/geany/?rev=4566&view=rev
Author: eht16
Date: 2010-01-25 21:16:55 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
Backport from trunk:
Define G_GNUC_WARN_UNUSED_RESULT if GLib < 2.10.
Modified Paths:
--------------
branches/geany-0.18.1/ChangeLog
branches/geany-0.18.1/src/geany.h
Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog 2010-01-25 21:16:46 UTC (rev 4565)
+++ branches/geany-0.18.1/ChangeLog 2010-01-25 21:16:55 UTC (rev 4566)
@@ -1,3 +1,9 @@
+2009-08-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/geany.h:
+ Define G_GNUC_WARN_UNUSED_RESULT if GLib < 2.10.
+
+
2009-08-26 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* doc/plugins.dox:
Modified: branches/geany-0.18.1/src/geany.h
===================================================================
--- branches/geany-0.18.1/src/geany.h 2010-01-25 21:16:46 UTC (rev 4565)
+++ branches/geany-0.18.1/src/geany.h 2010-01-25 21:16:55 UTC (rev 4566)
@@ -91,4 +91,9 @@
/* prototype is here so that all files can use it. */
void geany_debug(gchar const *format, ...) G_GNUC_PRINTF (1, 2);
+
+#ifndef G_GNUC_WARN_UNUSED_RESULT
+#define G_GNUC_WARN_UNUSED_RESULT
#endif
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4565
http://geany.svn.sourceforge.net/geany/?rev=4565&view=rev
Author: eht16
Date: 2010-01-25 21:16:46 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
Backport from trunk:
Add section 'Plugin API/ABI design'.
Modified Paths:
--------------
branches/geany-0.18.1/ChangeLog
branches/geany-0.18.1/HACKING
Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog 2010-01-25 21:16:38 UTC (rev 4564)
+++ branches/geany-0.18.1/ChangeLog 2010-01-25 21:16:46 UTC (rev 4565)
@@ -3,6 +3,8 @@
* doc/plugins.dox:
Add warning about not using undocumented features.
Add reference to HACKING for plugin API development.
+ * HACKING:
+ Add section 'Plugin API/ABI design'.
2009-08-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: branches/geany-0.18.1/HACKING
===================================================================
--- branches/geany-0.18.1/HACKING 2010-01-25 21:16:38 UTC (rev 4564)
+++ branches/geany-0.18.1/HACKING 2010-01-25 21:16:46 UTC (rev 4565)
@@ -72,7 +72,7 @@
.. warning::
- Some structs like GeanyKeyGroup and GeanyCallback cannot be
+ Some structs like GeanyKeyGroupInfo and GeanyCallback cannot be
appended to without breaking the ABI because they are used to declare
structs by plugins, not just for accessing struct members through
a pointer.
@@ -82,7 +82,7 @@
not load and they must be rebuilt. An API change means that some plugins
might not build correctly.
-When reordering or changing existing elements of structs that are
+If you're reordering or changing existing elements of structs that are
used as part of the plugin API, you should increment GEANY_ABI_VERSION
in plugindata.h. This is usually not needed if you're just appending
fields to structs. The GEANY_API_VERSION value should be incremented
@@ -90,6 +90,15 @@
If you're in any doubt when making changes to plugin API code, just ask us.
+Plugin API/ABI design
+---------------------
+You should not make plugins rely on the size of a struct. This means:
+
+* Don't let plugins allocate any structs (stack or heap).
+* Don't let plugins index any arrays of structs.
+* Don't add any array fields to structs in case we want to change the
+ array size later.
+
Glade
-----
Use the code generation features of Glade instead of editing interface.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4564
http://geany.svn.sourceforge.net/geany/?rev=4564&view=rev
Author: eht16
Date: 2010-01-25 21:16:38 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
Backport from trunk:
Add warning about not using undocumented features.
Add reference to HACKING for plugin API development.
Modified Paths:
--------------
branches/geany-0.18.1/ChangeLog
branches/geany-0.18.1/doc/plugins.dox
Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog 2010-01-25 21:16:27 UTC (rev 4563)
+++ branches/geany-0.18.1/ChangeLog 2010-01-25 21:16:38 UTC (rev 4564)
@@ -1,3 +1,10 @@
+2009-08-26 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * doc/plugins.dox:
+ Add warning about not using undocumented features.
+ Add reference to HACKING for plugin API development.
+
+
2009-08-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* tagmanager/php.c:
Modified: branches/geany-0.18.1/doc/plugins.dox
===================================================================
--- branches/geany-0.18.1/doc/plugins.dox 2010-01-25 21:16:27 UTC (rev 4563)
+++ branches/geany-0.18.1/doc/plugins.dox 2010-01-25 21:16:38 UTC (rev 4564)
@@ -29,26 +29,29 @@
/**
*
- * @mainpage Geany Plugin API Documentation
+ * @mainpage Geany Plugin API Documentation
*
- * @author Enrico Tröger, Nick Treleaven, Frank Lanitz
- * @date $Date$
+ * @author Enrico Tröger, Nick Treleaven, Frank Lanitz
+ * @date $Date$
*
- * @section Intro
- * This is the Geany API documentation. It is far from being complete and should be
- * considered as a work in progress.
- * We will try to document as many functions and structs as possible.
+ * @section Intro
+ * This is the Geany API documentation. It is far from being complete and should be
+ * considered as a work in progress.
+ * We will try to document as many functions and structs as possible.
*
- * To get started, see the @link howto Plugin Howto @endlink.
+ * To get started, see the @link howto Plugin Howto @endlink.
*
- * Other pages:
- * - @link pluginsymbols.c Plugin Symbols @endlink
- * - @link plugindata.h Main Datatypes and Macros @endlink
- * - @link signals Plugin Signals @endlink
- * - @link pluginutils.c Plugin Utility Functions @endlink
- * - @link guidelines Plugin Writing Guidelines @endlink
+ * Other pages:
+ * - @link pluginsymbols.c Plugin Symbols @endlink
+ * - @link plugindata.h Main Datatypes and Macros @endlink
+ * - @link signals Plugin Signals @endlink
+ * - @link pluginutils.c Plugin Utility Functions @endlink
+ * - @link guidelines Plugin Writing Guidelines @endlink
*
- * @note Some of these pages are also listed in Related Pages.
+ * @note Some of these pages are also listed in Related Pages, plus the list of deprecated symbols.
+ * @warning Do not use anything not documented here, it may change.
+ * @note You should see the HACKING file for information about developing the plugin API and
+ * other useful things.
*/
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4563
http://geany.svn.sourceforge.net/geany/?rev=4563&view=rev
Author: eht16
Date: 2010-01-25 21:16:27 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
Backport from trunk:
Don't parse comments after import statements and other tags (closes #2838938, patch by Huandari Lopez, thanks).
Modified Paths:
--------------
branches/geany-0.18.1/ChangeLog
branches/geany-0.18.1/tagmanager/python.c
Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog 2010-01-25 21:16:16 UTC (rev 4562)
+++ branches/geany-0.18.1/ChangeLog 2010-01-25 21:16:27 UTC (rev 4563)
@@ -5,6 +5,9 @@
whitespace before the 'function' keyword to ignore some false
positives like function tags inside comments
(patch by Harold Aling, thanks).
+ * tagmanager/python.c:
+ Don't parse comments after import statements and other tags
+ (closes #2838938, patch by Huandari Lopez, thanks).
2009-08-20 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: branches/geany-0.18.1/tagmanager/python.c
===================================================================
--- branches/geany-0.18.1/tagmanager/python.c 2010-01-25 21:16:16 UTC (rev 4562)
+++ branches/geany-0.18.1/tagmanager/python.c 2010-01-25 21:16:27 UTC (rev 4563)
@@ -166,7 +166,7 @@
{
for (; *cp; cp++)
{
- if (*cp == '"' || *cp == '\'')
+ if (*cp == '"' || *cp == '\'' || *cp == '#')
{
cp = skipString(cp);
if (!*cp) break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.