SF.net SVN: geany:[3964] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Tue Jul 14 13:05:51 UTC 2009
Revision: 3964
http://geany.svn.sourceforge.net/geany/?rev=3964&view=rev
Author: ntrel
Date: 2009-07-14 13:05:51 +0000 (Tue, 14 Jul 2009)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/document.h
trunk/src/filetypes.c
trunk/src/filetypes.h
trunk/src/geany.h
trunk/src/main.c
trunk/src/plugindata.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-07-14 11:25:07 UTC (rev 3963)
+++ trunk/ChangeLog 2009-07-14 13:05:51 UTC (rev 3964)
@@ -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>
Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h 2009-07-14 11:25:07 UTC (rev 3963)
+++ trunk/src/document.h 2009-07-14 13:05:51 UTC (rev 3964)
@@ -109,10 +109,20 @@
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
* closed since then.
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2009-07-14 11:25:07 UTC (rev 3963)
+++ trunk/src/filetypes.c 2009-07-14 13:05:51 UTC (rev 3964)
@@ -648,15 +648,6 @@
}
-/* 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));
Modified: trunk/src/filetypes.h
===================================================================
--- trunk/src/filetypes.h 2009-07-14 11:25:07 UTC (rev 3963)
+++ trunk/src/filetypes.h 2009-07-14 13:05:51 UTC (rev 3964)
@@ -141,9 +141,10 @@
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;
Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h 2009-07-14 11:25:07 UTC (rev 3963)
+++ trunk/src/geany.h 2009-07-14 13:05:51 UTC (rev 3964)
@@ -39,7 +39,10 @@
# 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 */
#define GEANY_FILEDEFS_SUBDIR "filedefs"
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2009-07-14 11:25:07 UTC (rev 3963)
+++ trunk/src/main.c 2009-07-14 13:05:51 UTC (rev 3964)
@@ -1232,14 +1232,9 @@
/* filetypes_load_config() will skip not loaded filetypes */
filetypes_load_config(i, TRUE);
}
+ documents_foreach(i)
+ document_reload_config(documents[i]);
- for (i = 0; i < documents_array->len; i++)
- {
- GeanyDocument *doc = documents[i];
- if (doc->is_valid)
- document_reload_config(doc);
- }
-
/* C tag names to ignore */
symbols_reload_config_files();
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2009-07-14 11:25:07 UTC (rev 3963)
+++ trunk/src/plugindata.h 2009-07-14 13:05:51 UTC (rev 3964)
@@ -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 */
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