Commit: c3c2ea39b21cd92ab516f15ba1cb5bd8f9c71ff6
Author: Jacques Lucke
Date: Sat Mar 7 13:05:16 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rBc3c2ea39b21cd92ab516f15ba1cb5bd8f9c71ff6
move blenloader callback api to single file
===================================================================
M source/blender/blenkernel/intern/colortools.c
A source/blender/blenloader/BLO_callback_api.h
M source/blender/blenloader/BLO_readfile.h
M source/blender/blenloader/BLO_writefile.h
M source/blender/blenloader/CMakeLists.txt
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
===================================================================
diff --git a/source/blender/blenkernel/intern/colortools.c
b/source/blender/blenkernel/intern/colortools.c
index e0fb02c058d..e7eecd642eb 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -44,8 +44,7 @@
#include "IMB_colormanagement.h"
#include "IMB_imbuf_types.h"
-#include "BLO_writefile.h"
-#include "BLO_readfile.h"
+#include "BLO_callback_api.h"
/* ********************************* color curve ********************* */
diff --git a/source/blender/blenloader/BLO_callback_api.h
b/source/blender/blenloader/BLO_callback_api.h
new file mode 100644
index 00000000000..1d7d1235ec8
--- /dev/null
+++ b/source/blender/blenloader/BLO_callback_api.h
@@ -0,0 +1,46 @@
+#ifndef __BLO_CALLBACK_API_H__
+#define __BLO_CALLBACK_API_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct BloWriter BloWriter;
+typedef struct BloReader BloReader;
+
+/* API for file writing.
+ **********************************************/
+
+void BLO_write_raw(BloWriter *writer, const void *data_ptr, int length);
+void BLO_write_struct_by_name(BloWriter *writer, const char *struct_name,
const void *data_ptr);
+void BLO_write_struct_array_by_name(BloWriter *writer,
+ const char *struct_name,
+ const void *data_ptr,
+ int array_size);
+void BLO_write_struct_by_id(BloWriter *writer, int struct_id, const void
*data_ptr);
+void BLO_write_struct_array_by_id(BloWriter *writer,
+ int struct_id,
+ const void *data_ptr,
+ int array_size);
+
+int BLO_get_struct_id_by_name(BloWriter *writer, const char *struct_name);
+#define BLO_get_struct_id(writer, struct_name)
BLO_get_struct_id_by_name(writer, #struct_name)
+
+#define BLO_write_struct(writer, struct_name, data_ptr) \
+ BLO_write_struct_by_id(writer, BLO_get_struct_id(writer, struct_name),
data_ptr)
+#define BLO_write_struct_array(writer, struct_name, data_ptr, array_size) \
+ BLO_write_struct_array_by_id( \
+ writer, BLO_get_struct_id(writer, struct_name), data_ptr, array_size)
+
+/* API for file reading.
+ **********************************************/
+
+void *BLO_read_new_address(BloReader *reader, const void *old_address);
+bool BLO_read_requires_endian_switch(BloReader *reader);
+#define BLO_read_update_address(reader, ptr) ptr =
BLO_read_new_address(reader, ptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BLO_CALLBACK_API_H__ */
diff --git a/source/blender/blenloader/BLO_readfile.h
b/source/blender/blenloader/BLO_readfile.h
index 4ca858b5b1f..00dbe334356 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -176,12 +176,6 @@ struct BlendThumbnail *BLO_thumbnail_from_file(const char
*filepath);
extern const struct bTheme U_theme_default;
extern const struct UserDef U_default;
-typedef struct BloReader BloReader;
-
-void *BLO_read_new_address(BloReader *reader, const void *old_address);
-bool BLO_read_requires_endian_switch(BloReader *reader);
-#define BLO_read_update_address(reader, ptr) ptr =
BLO_read_new_address(reader, ptr)
-
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenloader/BLO_writefile.h
b/source/blender/blenloader/BLO_writefile.h
index eee76b14904..d83abf7f9ed 100644
--- a/source/blender/blenloader/BLO_writefile.h
+++ b/source/blender/blenloader/BLO_writefile.h
@@ -40,26 +40,4 @@ extern bool BLO_write_file_mem(struct Main *mainvar,
struct MemFile *current,
int write_flags);
-typedef struct BloWriter BloWriter;
-
-void BLO_write_raw(BloWriter *writer, const void *data_ptr, int length);
-void BLO_write_struct_by_name(BloWriter *writer, const char *struct_name,
const void *data_ptr);
-void BLO_write_struct_array_by_name(BloWriter *writer,
- const char *struct_name,
- const void *data_ptr,
- int array_size);
-void BLO_write_struct_by_id(BloWriter *writer, int struct_id, const void
*data_ptr);
-void BLO_write_struct_array_by_id(BloWriter *writer,
- int struct_id,
- const void *data_ptr,
- int array_size);
-
-int BLO_get_struct_id_by_name(BloWriter *writer, const char *struct_name);
-#define BLO_get_struct_id(writer, struct_name)
BLO_get_struct_id_by_name(writer, #struct_name)
-
-#define BLO_write_struct(writer, struct_name, data_ptr) \
- BLO_write_struct_by_id(writer, BLO_get_struct_id(writer, struct_name),
data_ptr)
-#define BLO_write_struct_array(writer, struct_name, data_ptr, array_size) \
- BLO_write_struct_array_by_id(writer, BLO_get_struct_id(writer, struct_name),
data_ptr, array_size)
-
#endif
diff --git a/source/blender/blenloader/CMakeLists.txt
b/source/blender/blenloader/CMakeLists.txt
index 1520c7b82b8..920b4428216 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -62,6 +62,7 @@ set(SRC
BLO_blend_defs.h
BLO_blend_validate.h
+ BLO_callback_api.h
BLO_readfile.h
BLO_undofile.h
BLO_writefile.h
diff --git a/source/blender/blenloader/intern/readfile.c
b/source/blender/blenloader/intern/readfile.c
index 45095322bc5..22ed46b3c6d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -154,6 +154,7 @@
#include "BLO_blend_validate.h"
#include "BLO_readfile.h"
#include "BLO_undofile.h"
+#include "BLO_callback_api.h"
#include "RE_engine.h"
diff --git a/source/blender/blenloader/intern/writefile.c
b/source/blender/blenloader/intern/writefile.c
index 8ea7a139c0e..6ee83ededb2 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -174,6 +174,7 @@
#include "BLO_readfile.h"
#include "BLO_undofile.h"
#include "BLO_writefile.h"
+#include "BLO_callback_api.h"
#include "readfile.h"
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs