Kaydet (Commit) 99641558 authored tarafından Nick Treleaven's avatar Nick Treleaven

Add documents_foreach() API macro that skips invalid docs.

Make filetypes[], documents[] part of the API again.
Add GEANY() macro for sharing geany symbols between API and core.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3964 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 4edd25c8
......@@ -10,6 +10,11 @@
Make Mark highlighting brighter.
* src/interface.c, doc/geany.txt, doc/geany.html, geany.glade:
Use hyphen for auto-feature terms.
* src/plugindata.h, src/geany.h, src/filetypes.c, src/filetypes.h,
src/document.h, src/main.c:
Add documents_foreach() API macro that skips invalid docs.
Make filetypes[], documents[] part of the API again.
Add GEANY() macro for sharing geany symbols between API and core.
2009-07-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
......
......@@ -109,9 +109,19 @@ struct GeanyDocument
extern GPtrArray *documents_array;
/* Wrap documents_array so it can be used with C array syntax.
* Example: documents[0]->sci = NULL; */
#define documents ((GeanyDocument **)documents_array->pdata)
/** Wrap documents_array so it can be used with C array syntax.
* Example: documents[0]->sci = NULL;
* @see document_index(). */
#define documents ((GeanyDocument **)GEANY(documents_array)->pdata)
/** Iterates all valid documents.
* Use like a @c for statement.
* @param i @c guint index for document_index(). */
#define documents_foreach(i) \
for (i = 0; i < GEANY(documents_array)->len; i++)\
if (!documents[i]->is_valid)\
{}\
else /* prevent outside 'else' matching our macro 'if' */
/** @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
......
......@@ -648,15 +648,6 @@ void filetypes_init_types()
}
/* Iterates all valid documents.
* Use like a @c for statement.
* @param i @c guint index for document_index(). */
#define documents_foreach(i) \
for (i = 0; i < documents_array->len; i++)\
if (!document_index(i)->is_valid)\
{}\
else /* prevent outside 'else' matching our macro 'if' */
static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc)
{
g_return_if_fail(NZV(doc->real_path));
......
......@@ -141,9 +141,10 @@ struct GeanyFiletype
extern GPtrArray *filetypes_array;
/* Wrap filetypes_array so it can be used with C array syntax.
* Example: filetypes[GEANY_FILETYPES_C]->name = ...; */
#define filetypes ((GeanyFiletype **)filetypes_array->pdata)
/** Wrap filetypes_array so it can be used with C array syntax.
* Example: filetypes[GEANY_FILETYPES_C]->name = ...;
* @see filetypes_index(). */
#define filetypes ((GeanyFiletype **)GEANY(filetypes_array)->pdata)
extern GSList *filetypes_by_title;
......
......@@ -39,6 +39,9 @@
# define PLAT_GTK 1 /* needed when including ScintillaWidget.h */
#endif
/* Compatibility for sharing macros between API and core, overridden in plugindata.h */
#define GEANY(symbol_name) symbol_name
/* for detailed description look in the documentation, things are not
* listed in the documentation should not be changed */
......
......@@ -1232,13 +1232,8 @@ void main_reload_configuration(void)
/* filetypes_load_config() will skip not loaded filetypes */
filetypes_load_config(i, TRUE);
}
for (i = 0; i < documents_array->len; i++)
{
GeanyDocument *doc = documents[i];
if (doc->is_valid)
document_reload_config(doc);
}
documents_foreach(i)
document_reload_config(documents[i]);
/* C tag names to ignore */
symbols_reload_config_files();
......
......@@ -35,6 +35,11 @@
#ifndef PLUGINDATA_H
#define PLUGINDATA_H
/* Compatibility for sharing macros between API and core.
* First include geany.h, then plugindata.h, then other API headers. */
#undef GEANY
#define GEANY(symbol_name) geany->symbol_name
#include "editor.h" /* GeanyIndentType */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment