diff --git a/src/c_gen.rs b/src/c_gen.rs index 49c69b5..829b526 100644 --- a/src/c_gen.rs +++ b/src/c_gen.rs @@ -67,6 +67,7 @@ impl LdmcCTargetMorph { LdmcCTargetMorph { includes: vec![ "#include <stdint.h>".into(), + "#define FUSE(x) { int result = x; if(result) return result; }".into() ], active_instantiations: Vec::new(), active_types: Vec::new(), @@ -98,6 +99,7 @@ impl LdmcCTargetMorph { let mut source = String::new(); for inc in self.includes { source.push_str(&inc); + source.push('\n'); } for ty in self.active_types { @@ -175,7 +177,7 @@ impl LdmcCTargetMorph { {{ {} const * restrict src = {}; {} * restrict dst = {}; - {} ( src, dst ); + FUSE( {} ( src, dst ) ); }}"#, src_c_type, src_buf, dst_c_type, dst_buf, @@ -224,7 +226,7 @@ impl LdmcCTargetMorph { {{ {} const * restrict src = (void*) {}; {} * restrict dst = (void*) {}; - {} ( {}, src, dst ); + FUSE( {} ( {}, src, dst ); }}"#, src_c_type, src_buf, dst_c_type, dst_buf, @@ -256,7 +258,7 @@ impl LdmcCTargetMorph { let name = name.replace("-", "_").replace(".","_dot_"); c_source.push_str( &format!(" - {} ( &src->{}, &dst->{} ); + FUSE( {} ( &src->{}, &dst->{} ) ); ", inst.symbol, name, name