[vala/staging: 1/3] ccode: Allow to add defines in a special section
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 1/3] ccode: Allow to add defines in a special section
- Date: Thu, 20 May 2021 10:01:38 +0000 (UTC)
commit acc059f8ede46b3165bb4eabeb77e5e81d455ce4
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu May 20 11:00:37 2021 +0200
ccode: Allow to add defines in a special section
ccode/valaccodefile.vala | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/ccode/valaccodefile.vala b/ccode/valaccodefile.vala
index 629d2d198..f61da07df 100644
--- a/ccode/valaccodefile.vala
+++ b/ccode/valaccodefile.vala
@@ -32,6 +32,7 @@ public class Vala.CCodeFile {
Set<string> includes = new HashSet<string> (str_hash, str_equal);
CCodeFragment comments = new CCodeFragment ();
CCodeFragment feature_test_macros = new CCodeFragment ();
+ CCodeFragment define_directives = new CCodeFragment ();
CCodeFragment include_directives = new CCodeFragment ();
CCodeFragment type_declaration = new CCodeFragment ();
CCodeFragment type_definition = new CCodeFragment ();
@@ -70,6 +71,10 @@ public class Vala.CCodeFile {
}
}
+ public void add_define (CCodeNode node) {
+ define_directives.append (node);
+ }
+
public void add_type_declaration (CCodeNode node) {
type_declaration.append (node);
}
@@ -161,6 +166,8 @@ public class Vala.CCodeFile {
writer.write_newline ();
include_directives.write (writer);
writer.write_newline ();
+ define_directives.write (writer);
+ writer.write_newline ();
type_declaration.write_combined (writer);
writer.write_newline ();
type_definition.write_combined (writer);
@@ -186,6 +193,8 @@ public class Vala.CCodeFile {
once.append (new CCodeNewline ());
}
+ once.append (new CCodeNewline ());
+ once.append (define_directives);
once.append (new CCodeNewline ());
once.append (type_declaration);
once.append (new CCodeNewline ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]