summaryrefslogtreecommitdiffstats
path: root/devel-docs/includes.txt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:13:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:13:10 +0000
commit3c57dd931145d43f2b0aef96c4d178135956bf91 (patch)
tree3de698981e9f0cc2c4f9569b19a5f3595e741f6b /devel-docs/includes.txt
parentInitial commit. (diff)
downloadgimp-3c57dd931145d43f2b0aef96c4d178135956bf91.tar.xz
gimp-3c57dd931145d43f2b0aef96c4d178135956bf91.zip
Adding upstream version 2.10.36.upstream/2.10.36
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devel-docs/includes.txt')
-rw-r--r--devel-docs/includes.txt51
1 files changed, 51 insertions, 0 deletions
diff --git a/devel-docs/includes.txt b/devel-docs/includes.txt
new file mode 100644
index 0000000..3fdd9a1
--- /dev/null
+++ b/devel-docs/includes.txt
@@ -0,0 +1,51 @@
+includes.txt
+============
+
+The include policy for the files in app/ is as follows:
+
+Each subdirectory has a <module>-types.h file which defines the type
+space known to this module. All .c files in the directory include this
+(and only this) <module>-types.h file. <foo>-types.h files from other
+modules are included from the <module>-types.h file only. This way
+<module>-types.h becomes the only place where the namespace known to a
+module is defined.
+
+
+***** .h files *****
+
+No .h file includes anything, with two exceptions:
+
+- objects include their immediate parent class
+- if the header uses stuff like time_t (or off_t), it includes
+ <time.h> (or <sys/types.h>). This only applies to system stuff!
+
+
+***** .c files *****
+
+The include order of all .c files of a module is as follows:
+
+/* example of a .c file from app/core */
+
+#include "config.h" /* always and first */
+
+#include <glib.h> /* *only* needed if the file needs stuff */
+ /* like G_OS_WIN32 for conditional inclusion */
+ /* of system headers */
+
+#include <system headers> /* like <stdio.h> */
+
+#include <glib-object.h>
+
+#include "libgimpfoo/gimpfoo.h" /* as needed, e.g. "libgimpbase/gimpbase.h" */
+#include "libgimpbar/gimpbar.h"
+
+#include "core-types.h" /* and _no_ other foo-types.h file */
+
+#include "base/foo.h" /* files from modules below this one */
+#include "base/bar.h"
+
+#include "gimp.h" /* files from this module */
+#include "gimpimage.h"
+#include "gimpwhatever.h"
+
+#include "gimp-intl.h" /* if needed, *must* be the last include */