summaryrefslogtreecommitdiff
path: root/fluid/io
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2025-04-15 14:47:24 +0200
committerGitHub <noreply@github.com>2025-04-15 14:47:24 +0200
commitfc91880faf7968432710e439e77ef067759d16fc (patch)
treef941b5ebbc70e8380775098a225001c2379b6e0f /fluid/io
parent63db80c07888e5f4dcaff3579a0d174b7df5424d (diff)
Reactivating Mergeback functionality. (#1226)
Reactivated code. Various fixes. New documentation.
Diffstat (limited to 'fluid/io')
-rw-r--r--fluid/io/Code_Writer.cxx15
-rw-r--r--fluid/io/Code_Writer.h4
2 files changed, 12 insertions, 7 deletions
diff --git a/fluid/io/Code_Writer.cxx b/fluid/io/Code_Writer.cxx
index c9e638c93..b7179826d 100644
--- a/fluid/io/Code_Writer.cxx
+++ b/fluid/io/Code_Writer.cxx
@@ -18,6 +18,7 @@
#include "Fluid.h"
#include "Project.h"
+#include "proj/mergeback.h"
#include "nodes/Window_Node.h"
#include "nodes/Function_Node.h"
@@ -28,6 +29,7 @@
using namespace fld;
using namespace fld::io;
+using namespace fld::proj;
/**
Return true if c can be in a C identifier.
@@ -103,11 +105,11 @@ const char* Code_Writer::unique_id(void* o, const char* type, const char* name,
\return pointer to a static string
*/
const char *Code_Writer::indent(int set) {
- static const char* spaces = " ";
+ static const char* spaces = " ";
int i = set * 2;
- if (i>32) i = 32;
+ if (i>64) i = 64;
if (i<0) i = 0;
- return spaces+32-i;
+ return spaces+64-i;
}
/**
@@ -774,9 +776,10 @@ Code_Writer::~Code_Writer()
\param[in] type FD_TAG_GENERIC, FD_TAG_CODE, FD_TAG_MENU_CALLBACK, or FD_TAG_WIDGET_CALLBACK
\param[in] uid the unique id of the current type
*/
-void Code_Writer::tag(int type, unsigned short uid) {
- if (proj_.write_mergeback_data)
- fprintf(code_file, "//~fl~%d~%04x~%08x~~\n", type, (int)uid, (unsigned int)block_crc_);
+void Code_Writer::tag(proj::Mergeback::Tag prev_type, proj::Mergeback::Tag next_type, unsigned short uid) {
+ if (proj_.write_mergeback_data) {
+ Mergeback::print_tag(code_file, prev_type, next_type, uid, (uint32_t)block_crc_);
+ }
block_crc_ = crc32(0, nullptr, 0);
}
diff --git a/fluid/io/Code_Writer.h b/fluid/io/Code_Writer.h
index ca23ca0a2..c199197ec 100644
--- a/fluid/io/Code_Writer.h
+++ b/fluid/io/Code_Writer.h
@@ -17,6 +17,8 @@
#ifndef FLUID_IO_CODE_WRITER_H
#define FLUID_IO_CODE_WRITER_H
+#include "proj/mergeback.h"
+
#include <FL/fl_attr.h>
#include <stdarg.h>
@@ -114,7 +116,7 @@ public:
int write_code(const char *cfile, const char *hfile, bool to_codeview=false);
void write_public(int state); // writes pubic:/private: as needed
- void tag(int type, unsigned short uid);
+ void tag(proj::Mergeback::Tag prev_type, proj::Mergeback::Tag next_type, unsigned short uid);
static unsigned long block_crc(const void *data, int n=-1, unsigned long in_crc=0, bool *inout_line_start=nullptr);
};