From 80a8939612de39ea18b453c88736a2bf1fd94a19 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Tue, 2 Dec 2008 17:05:50 +0000 Subject: [PATCH] Add header guards for geanyfunctions.h and include pluginmacros.h temporarily. Update Demo plugin. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3306 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 4 ++++ plugins/demoplugin.c | 6 +++--- plugins/geanyfunctions.h | 7 +++++++ plugins/genapi.py | 6 +++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46ab7cddd..289164940 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,10 @@ p_plugin->add_toolbar_item(...). Note: For now, building on Windows or with Waf needs genapi.py to be run manually when adding plugin API functions. + * plugins/geanyfunctions.h, plugins/demoplugin.c, plugins/genapi.py: + Add header guards for geanyfunctions.h and include pluginmacros.h + temporarily. + Update Demo plugin. 2008-12-01 Nick Treleaven diff --git a/plugins/demoplugin.c b/plugins/demoplugin.c index 7139ec482..f42b21eef 100644 --- a/plugins/demoplugin.c +++ b/plugins/demoplugin.c @@ -40,7 +40,7 @@ #include "ui_utils.h" #include "plugindata.h" /* this defines the plugin API */ -#include "pluginmacros.h" /* some useful macros to save typing */ +#include "geanyfunctions.h" /* this wraps geany_functions function pointers */ /* These items are set by Geany before plugin_init() is called. */ @@ -51,7 +51,7 @@ GeanyFunctions *geany_functions; /* Check that the running Geany supports the plugin API used below, and check * for binary compatibility. */ -PLUGIN_VERSION_CHECK(100) +PLUGIN_VERSION_CHECK(112) /* All plugins must set name, description, version and author. */ PLUGIN_SET_INFO(_("Demo"), _("Example plugin."), VERSION, _("The Geany developer team")) @@ -95,7 +95,7 @@ void plugin_init(GeanyData *data) g_signal_connect(demo_item, "activate", G_CALLBACK(item_activate), NULL); /* make the menu item sensitive only when documents are open */ - p_ui->add_document_sensitive(demo_item); + ui_add_document_sensitive(demo_item); /* keep a pointer to the menu item, so we can remove it when the plugin is unloaded */ main_menu_item = demo_item; diff --git a/plugins/geanyfunctions.h b/plugins/geanyfunctions.h index 3328a2d6a..a628c5468 100644 --- a/plugins/geanyfunctions.h +++ b/plugins/geanyfunctions.h @@ -1,3 +1,8 @@ +#ifndef GEANY_FUNCTIONS_H +#define GEANY_FUNCTIONS_H + +#include "pluginmacros.h" + #define plugin_add_toolbar_item \ p_plugin->add_toolbar_item #define document_new_file \ @@ -218,3 +223,5 @@ p_main->reload_configuration #define main_locale_init \ p_main->locale_init + +#endif diff --git a/plugins/genapi.py b/plugins/genapi.py index f3ca46ce6..040e4df92 100755 --- a/plugins/genapi.py +++ b/plugins/genapi.py @@ -63,9 +63,13 @@ if __name__ == "__main__": sys.exit("No function names read!") f = open(outfile, 'w') + print >>f, '#ifndef GEANY_FUNCTIONS_H' + print >>f, '#define GEANY_FUNCTIONS_H\n' + print >>f, '#include "pluginmacros.h"\n' for fname in fnames: ptr, name = get_api_tuple(fname) - print >>f, '#define ' + fname + ' \\\n\t' + ptr + '->' + name + print >>f, '#define %s \\\n\t%s->%s' % (fname, ptr, name) + print >>f, '\n#endif' f.close print 'Generated ' + outfile