SF.net SVN: geany:[3311] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Thu Dec 4 13:26:48 UTC 2008
Revision: 3311
http://geany.svn.sourceforge.net/geany/?rev=3311&view=rev
Author: ntrel
Date: 2008-12-04 13:26:48 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
Deprecate pluginmacros.h in favour of geanyfunctions.h.
Move geany macro to plugindata.h.
Remove geanyfunctions.h dependency on pluginmacros.h.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/plugins.dox
trunk/doc/pluginsymbols.c
trunk/plugins/geanyfunctions.h
trunk/plugins/genapi.py
trunk/plugins/pluginmacros.h
trunk/src/document.h
trunk/src/plugindata.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-12-03 18:03:54 UTC (rev 3310)
+++ trunk/ChangeLog 2008-12-04 13:26:48 UTC (rev 3311)
@@ -1,3 +1,13 @@
+2008-12-04 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/plugindata.h, src/document.h, doc/pluginsymbols.c,
+ doc/plugins.dox, plugins/geanyfunctions.h, plugins/pluginmacros.h,
+ plugins/genapi.py:
+ Deprecate pluginmacros.h in favour of geanyfunctions.h.
+ Move geany macro to plugindata.h.
+ Remove geanyfunctions.h dependency on pluginmacros.h.
+
+
2008-12-03 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* plugins/Makefile.am, src/Makefile.am:
Modified: trunk/doc/plugins.dox
===================================================================
--- trunk/doc/plugins.dox 2008-12-03 18:03:54 UTC (rev 3310)
+++ trunk/doc/plugins.dox 2008-12-04 13:26:48 UTC (rev 3311)
@@ -43,7 +43,6 @@
* Other pages:
* - @link plugindata.h Main Datatypes and Macros @endlink
* - @link pluginsymbols.c Plugin Symbols @endlink
- * - @link pluginmacros.h Optional Macros @endlink
* - @link signals Plugin Signals @endlink
*
* @note Some of these pages are also listed in Related Pages.
Modified: trunk/doc/pluginsymbols.c
===================================================================
--- trunk/doc/pluginsymbols.c 2008-12-03 18:03:54 UTC (rev 3310)
+++ trunk/doc/pluginsymbols.c 2008-12-04 13:26:48 UTC (rev 3311)
@@ -55,10 +55,10 @@
const GeanyData *geany_data;
/** Geany owned function pointers, split into groups.
- * Example: @c geany_functions->p_document->new_file(NULL, NULL, NULL);
- *
- * Note: Usually plugins would use the pluginmacros.h file and just call:
- * @c p_document->new_file(NULL, NULL, NULL); */
+ * Example: @code #include "geanyfunctions.h"
+ * ...
+ * document_new_file(NULL, NULL, NULL); @endcode
+ * This is equivalent of @c geany_functions->p_document->new_file(NULL, NULL, NULL); */
const GeanyFunctions *geany_functions;
/** @deprecated Use @ref ui_add_document_sensitive() instead.
Modified: trunk/plugins/geanyfunctions.h
===================================================================
--- trunk/plugins/geanyfunctions.h 2008-12-03 18:03:54 UTC (rev 3310)
+++ trunk/plugins/geanyfunctions.h 2008-12-04 13:26:48 UTC (rev 3311)
@@ -1,240 +1,239 @@
/* @file geanyfunctions.h @ref geany_functions wrappers.
-This allows the use of normal API function names in plugins. */
+This allows the use of normal API function names in plugins.
+You need to declare the @ref geany_functions symbol yourself. */
#ifndef GEANY_FUNCTIONS_H
#define GEANY_FUNCTIONS_H
-#include "pluginmacros.h"
-
#define plugin_add_toolbar_item \
- p_plugin->add_toolbar_item
+ geany_functions->p_plugin->add_toolbar_item
#define document_new_file \
- p_document->new_file
+ geany_functions->p_document->new_file
#define document_get_current \
- p_document->get_current
+ geany_functions->p_document->get_current
#define document_get_from_page \
- p_document->get_from_page
+ geany_functions->p_document->get_from_page
#define document_find_by_filename \
- p_document->find_by_filename
+ geany_functions->p_document->find_by_filename
#define document_find_by_real_path \
- p_document->find_by_real_path
+ geany_functions->p_document->find_by_real_path
#define document_save_file \
- p_document->save_file
+ geany_functions->p_document->save_file
#define document_open_file \
- p_document->open_file
+ geany_functions->p_document->open_file
#define document_open_files \
- p_document->open_files
+ geany_functions->p_document->open_files
#define document_remove_page \
- p_document->remove_page
+ geany_functions->p_document->remove_page
#define document_reload_file \
- p_document->reload_file
+ geany_functions->p_document->reload_file
#define document_set_encoding \
- p_document->set_encoding
+ geany_functions->p_document->set_encoding
#define document_set_text_changed \
- p_document->set_text_changed
+ geany_functions->p_document->set_text_changed
#define document_set_filetype \
- p_document->set_filetype
+ geany_functions->p_document->set_filetype
#define document_close \
- p_document->close
+ geany_functions->p_document->close
#define document_index \
- p_document->index
+ geany_functions->p_document->index
#define editor_get_indent_prefs \
- p_editor->get_indent_prefs
+ geany_functions->p_editor->get_indent_prefs
#define editor_create_widget \
- p_editor->create_widget
+ geany_functions->p_editor->create_widget
#define editor_indicator_set_on_range \
- p_editor->indicator_set_on_range
+ geany_functions->p_editor->indicator_set_on_range
#define editor_indicator_set_on_line \
- p_editor->indicator_set_on_line
+ geany_functions->p_editor->indicator_set_on_line
#define editor_indicator_clear \
- p_editor->indicator_clear
+ geany_functions->p_editor->indicator_clear
#define editor_set_indent_type \
- p_editor->set_indent_type
+ geany_functions->p_editor->set_indent_type
#define scintilla_send_message \
- p_scintilla->send_message
+ geany_functions->p_scintilla->send_message
#define scintilla_new \
- p_scintilla->new
+ geany_functions->p_scintilla->new
#define dummyprefix_scintilla_send_message \
- p_dummyprefix->scintilla_send_message
+ geany_functions->p_dummyprefix->scintilla_send_message
#define sci_cmd \
- p_sci->cmd
+ geany_functions->p_sci->cmd
#define sci_start_undo_action \
- p_sci->start_undo_action
+ geany_functions->p_sci->start_undo_action
#define sci_end_undo_action \
- p_sci->end_undo_action
+ geany_functions->p_sci->end_undo_action
#define sci_set_text \
- p_sci->set_text
+ geany_functions->p_sci->set_text
#define sci_insert_text \
- p_sci->insert_text
+ geany_functions->p_sci->insert_text
#define sci_get_text \
- p_sci->get_text
+ geany_functions->p_sci->get_text
#define sci_get_length \
- p_sci->get_length
+ geany_functions->p_sci->get_length
#define sci_get_current_position \
- p_sci->get_current_position
+ geany_functions->p_sci->get_current_position
#define sci_set_current_position \
- p_sci->set_current_position
+ geany_functions->p_sci->set_current_position
#define sci_get_col_from_position \
- p_sci->get_col_from_position
+ geany_functions->p_sci->get_col_from_position
#define sci_get_line_from_position \
- p_sci->get_line_from_position
+ geany_functions->p_sci->get_line_from_position
#define sci_get_position_from_line \
- p_sci->get_position_from_line
+ geany_functions->p_sci->get_position_from_line
#define sci_replace_sel \
- p_sci->replace_sel
+ geany_functions->p_sci->replace_sel
#define sci_get_selected_text \
- p_sci->get_selected_text
+ geany_functions->p_sci->get_selected_text
#define sci_get_selected_text_length \
- p_sci->get_selected_text_length
+ geany_functions->p_sci->get_selected_text_length
#define sci_get_selection_start \
- p_sci->get_selection_start
+ geany_functions->p_sci->get_selection_start
#define sci_get_selection_end \
- p_sci->get_selection_end
+ geany_functions->p_sci->get_selection_end
#define sci_get_selection_mode \
- p_sci->get_selection_mode
+ geany_functions->p_sci->get_selection_mode
#define sci_set_selection_mode \
- p_sci->set_selection_mode
+ geany_functions->p_sci->set_selection_mode
#define sci_set_selection_start \
- p_sci->set_selection_start
+ geany_functions->p_sci->set_selection_start
#define sci_set_selection_end \
- p_sci->set_selection_end
+ geany_functions->p_sci->set_selection_end
#define sci_get_text_range \
- p_sci->get_text_range
+ geany_functions->p_sci->get_text_range
#define sci_get_line \
- p_sci->get_line
+ geany_functions->p_sci->get_line
#define sci_get_line_length \
- p_sci->get_line_length
+ geany_functions->p_sci->get_line_length
#define sci_get_line_count \
- p_sci->get_line_count
+ geany_functions->p_sci->get_line_count
#define sci_get_line_is_visible \
- p_sci->get_line_is_visible
+ geany_functions->p_sci->get_line_is_visible
#define sci_ensure_line_is_visible \
- p_sci->ensure_line_is_visible
+ geany_functions->p_sci->ensure_line_is_visible
#define sci_scroll_caret \
- p_sci->scroll_caret
+ geany_functions->p_sci->scroll_caret
#define sci_find_matching_brace \
- p_sci->find_matching_brace
+ geany_functions->p_sci->find_matching_brace
#define sci_get_style_at \
- p_sci->get_style_at
+ geany_functions->p_sci->get_style_at
#define sci_get_char_at \
- p_sci->get_char_at
+ geany_functions->p_sci->get_char_at
#define sci_get_current_line \
- p_sci->get_current_line
+ geany_functions->p_sci->get_current_line
#define sci_has_selection \
- p_sci->has_selection
+ geany_functions->p_sci->has_selection
#define sci_get_tab_width \
- p_sci->get_tab_width
+ geany_functions->p_sci->get_tab_width
#define sci_indicator_clear \
- p_sci->indicator_clear
+ geany_functions->p_sci->indicator_clear
#define sci_indicator_set \
- p_sci->indicator_set
+ geany_functions->p_sci->indicator_set
#define templates_get_template_fileheader \
- p_templates->get_template_fileheader
+ geany_functions->p_templates->get_template_fileheader
#define utils_str_equal \
- p_utils->str_equal
+ geany_functions->p_utils->str_equal
#define utils_string_replace_all \
- p_utils->string_replace_all
+ geany_functions->p_utils->string_replace_all
#define utils_get_file_list \
- p_utils->get_file_list
+ geany_functions->p_utils->get_file_list
#define utils_write_file \
- p_utils->write_file
+ geany_functions->p_utils->write_file
#define utils_get_locale_from_utf \
- p_utils->get_locale_from_utf
+ geany_functions->p_utils->get_locale_from_utf
#define utils_get_utf \
- p_utils->get_utf
+ geany_functions->p_utils->get_utf
#define utils_remove_ext_from_filename \
- p_utils->remove_ext_from_filename
+ geany_functions->p_utils->remove_ext_from_filename
#define utils_mkdir \
- p_utils->mkdir
+ geany_functions->p_utils->mkdir
#define utils_get_setting_boolean \
- p_utils->get_setting_boolean
+ geany_functions->p_utils->get_setting_boolean
#define utils_get_setting_integer \
- p_utils->get_setting_integer
+ geany_functions->p_utils->get_setting_integer
#define utils_get_setting_string \
- p_utils->get_setting_string
+ geany_functions->p_utils->get_setting_string
#define utils_spawn_sync \
- p_utils->spawn_sync
+ geany_functions->p_utils->spawn_sync
#define utils_spawn_async \
- p_utils->spawn_async
+ geany_functions->p_utils->spawn_async
#define utils_str_casecmp \
- p_utils->str_casecmp
+ geany_functions->p_utils->str_casecmp
#define utils_get_date_time \
- p_utils->get_date_time
+ geany_functions->p_utils->get_date_time
#define ui_dialog_vbox_new \
- p_ui->dialog_vbox_new
+ geany_functions->p_ui->dialog_vbox_new
#define ui_frame_new_with_alignment \
- p_ui->frame_new_with_alignment
+ geany_functions->p_ui->frame_new_with_alignment
#define ui_set_statusbar \
- p_ui->set_statusbar
+ geany_functions->p_ui->set_statusbar
#define ui_table_add_row \
- p_ui->table_add_row
+ geany_functions->p_ui->table_add_row
#define ui_path_box_new \
- p_ui->path_box_new
+ geany_functions->p_ui->path_box_new
#define ui_button_new_with_image \
- p_ui->button_new_with_image
+ geany_functions->p_ui->button_new_with_image
#define ui_add_document_sensitive \
- p_ui->add_document_sensitive
+ geany_functions->p_ui->add_document_sensitive
#define ui_widget_set_tooltip_text \
- p_ui->widget_set_tooltip_text
+ geany_functions->p_ui->widget_set_tooltip_text
#define ui_image_menu_item_new \
- p_ui->image_menu_item_new
+ geany_functions->p_ui->image_menu_item_new
#define ui_lookup_widget \
- p_ui->lookup_widget
+ geany_functions->p_ui->lookup_widget
#define dialogs_show_question \
- p_dialogs->show_question
+ geany_functions->p_dialogs->show_question
#define dialogs_show_msgbox \
- p_dialogs->show_msgbox
+ geany_functions->p_dialogs->show_msgbox
#define dialogs_show_save_as \
- p_dialogs->show_save_as
+ geany_functions->p_dialogs->show_save_as
#define lookup_widget \
- p_lookup->widget
+ geany_functions->p_lookup->widget
#define msgwin_status_add \
- p_msgwin->status_add
+ geany_functions->p_msgwin->status_add
#define msgwin_compiler_add_fmt \
- p_msgwin->compiler_add_fmt
+ geany_functions->p_msgwin->compiler_add_fmt
#define msgwin_msg_add_fmt \
- p_msgwin->msg_add_fmt
+ geany_functions->p_msgwin->msg_add_fmt
#define msgwin_clear_tab \
- p_msgwin->clear_tab
+ geany_functions->p_msgwin->clear_tab
#define msgwin_switch_tab \
- p_msgwin->switch_tab
+ geany_functions->p_msgwin->switch_tab
#define encodings_convert_to_utf \
- p_encodings->convert_to_utf
+ geany_functions->p_encodings->convert_to_utf
#define encodings_convert_to_utf \
- p_encodings->convert_to_utf
+ geany_functions->p_encodings->convert_to_utf
#define encodings_get_charset_from_index \
- p_encodings->get_charset_from_index
+ geany_functions->p_encodings->get_charset_from_index
#define keybindings_send_command \
- p_keybindings->send_command
+ geany_functions->p_keybindings->send_command
#define keybindings_set_item \
- p_keybindings->set_item
+ geany_functions->p_keybindings->set_item
#define tm_get_real_path \
- p_tm->get_real_path
+ geany_functions->p_tm->get_real_path
#define tm_source_file_new \
- p_tm->source_file_new
+ geany_functions->p_tm->source_file_new
#define tm_workspace_add_object \
- p_tm->workspace_add_object
+ geany_functions->p_tm->workspace_add_object
#define tm_source_file_update \
- p_tm->source_file_update
+ geany_functions->p_tm->source_file_update
#define tm_work_object_free \
- p_tm->work_object_free
+ geany_functions->p_tm->work_object_free
#define tm_workspace_remove_object \
- p_tm->workspace_remove_object
+ geany_functions->p_tm->workspace_remove_object
#define search_show_find_in_files_dialog \
- p_search->show_find_in_files_dialog
+ geany_functions->p_search->show_find_in_files_dialog
#define highlighting_get_style \
- p_highlighting->get_style
+ geany_functions->p_highlighting->get_style
#define filetypes_detect_from_file \
- p_filetypes->detect_from_file
+ geany_functions->p_filetypes->detect_from_file
#define filetypes_lookup_by_name \
- p_filetypes->lookup_by_name
+ geany_functions->p_filetypes->lookup_by_name
#define filetypes_index \
- p_filetypes->index
+ geany_functions->p_filetypes->index
#define navqueue_goto_line \
- p_navqueue->goto_line
+ geany_functions->p_navqueue->goto_line
#define main_reload_configuration \
- p_main->reload_configuration
+ geany_functions->p_main->reload_configuration
#define main_locale_init \
- p_main->locale_init
+ geany_functions->p_main->locale_init
#endif
Modified: trunk/plugins/genapi.py
===================================================================
--- trunk/plugins/genapi.py 2008-12-03 18:03:54 UTC (rev 3310)
+++ trunk/plugins/genapi.py 2008-12-04 13:26:48 UTC (rev 3311)
@@ -64,13 +64,13 @@
f = open(outfile, 'w')
print >>f, '/* @file %s @ref geany_functions wrappers. \n' % (outfile) +\
- 'This allows the use of normal API function names in plugins. */\n'
+ 'This allows the use of normal API function names in plugins.\n' +\
+ 'You need to declare the @ref geany_functions symbol yourself. */\n'
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 %s \\\n\t%s->%s' % (fname, ptr, name)
+ print >>f, '#define %s \\\n\tgeany_functions->%s->%s' % (fname, ptr, name)
print >>f, '\n#endif'
f.close
Modified: trunk/plugins/pluginmacros.h
===================================================================
--- trunk/plugins/pluginmacros.h 2008-12-03 18:03:54 UTC (rev 3310)
+++ trunk/plugins/pluginmacros.h 2008-12-04 13:26:48 UTC (rev 3311)
@@ -23,7 +23,8 @@
*/
/** @file pluginmacros.h
- * Useful macros to avoid typing @c geany_data-> or @c geany_functions-> so often.
+ * @deprecated Use geanyfunctions.h instead.
+ * Macros to avoid typing @c geany_functions-> so often.
*
* @section function_macros Function Macros
* These macros are named the same as the first word in the core function name,
@@ -36,9 +37,8 @@
#define PLUGINMACROS_H
/* common items */
-#define geany geany_data /**< Simple macro for @c geany_data that reduces typing. */
-#define documents_array geany_data->documents_array /**< Allows use of @c documents[] macro */
-#define filetypes_array geany_data->filetypes_array /**< Allows use of @c filetypes[] macro */
+#define documents_array geany_data->documents_array /**< @deprecated Use @c geany->documents_array->len and document_index() instead. */
+#define filetypes_array geany_data->filetypes_array /**< @deprecated Use @c geany->filetypes_array->len and filetypes_index() instead. */
/* function group macros */
Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h 2008-12-03 18:03:54 UTC (rev 3310)
+++ trunk/src/document.h 2008-12-04 13:26:48 UTC (rev 3311)
@@ -116,11 +116,11 @@
* Example: documents[0]->sci = NULL; */
#define documents ((GeanyDocument **)documents_array->pdata)
-/** Check that the @a doc_ptr document still exists (has not been closed).
+/** @c NULL-safe way to check @c doc_ptr->is_valid.
* This is useful when @a doc_ptr was stored some time earlier and documents may have been
* closed since then.
* @note This should not be used to check the result of the main API functions,
- * these only need a NULL-pointer check - @c p_document->get_current() != @c NULL. */
+ * these only need a NULL-pointer check - @c document_get_current() != @c NULL. */
#define DOC_VALID(doc_ptr) \
((doc_ptr) != NULL && (doc_ptr)->is_valid)
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2008-12-03 18:03:54 UTC (rev 3310)
+++ trunk/src/plugindata.h 2008-12-04 13:26:48 UTC (rev 3311)
@@ -191,7 +191,9 @@
}
GeanyData;
+#define geany geany_data /**< Simple macro for @c geany_data that reduces typing. */
+
/** This contains pointers to functions owned by Geany for plugins to use.
* Functions from the core can be appended when needed by plugin authors, but may
* require some changes. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list