summaryrefslogtreecommitdiff
path: root/ccode/valaccodemacroreplacement.vala
diff options
context:
space:
mode:
authorJuerg Billeter <j@bitron.ch>2007-11-03 22:42:43 +0000
committerJürg Billeter <juergbi@src.gnome.org>2007-11-03 22:42:43 +0000
commit8b48ec9ac550c5ae6183dfebd35ebd91aa58e147 (patch)
tree442525adbcf5aab5a89bc4e3a2cca1c6da99363d /ccode/valaccodemacroreplacement.vala
parent8fd6b40c44b3bb6482f75ffde5286a8b96d473db (diff)
downloadvala-8b48ec9ac550c5ae6183dfebd35ebd91aa58e147.tar.gz
use defines for public constants
2007-11-03 Juerg Billeter <j@bitron.ch> * gobject/valaccodegenerator.vala, ccode/valaccodemacroreplacement.vala: use defines for public constants svn path=/trunk/; revision=677
Diffstat (limited to 'ccode/valaccodemacroreplacement.vala')
-rw-r--r--ccode/valaccodemacroreplacement.vala28
1 files changed, 19 insertions, 9 deletions
diff --git a/ccode/valaccodemacroreplacement.vala b/ccode/valaccodemacroreplacement.vala
index 1d117b137..744f71136 100644
--- a/ccode/valaccodemacroreplacement.vala
+++ b/ccode/valaccodemacroreplacement.vala
@@ -1,6 +1,6 @@
/* valaccodemacroreplacement.vala
*
- * Copyright (C) 2006 Jürg Billeter
+ * Copyright (C) 2006-2007 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,23 +30,33 @@ public class Vala.CCodeMacroReplacement : CCodeNode {
* The name of this macro.
*/
public string! name { get; set construct; }
-
+
/**
* The replacement of this macro.
*/
- public string! replacement { get; set construct; }
-
- public CCodeMacroReplacement (string! n, string! replace) {
- name = n;
- replacement = replace;
+ public string! replacement { get; set; }
+
+ /**
+ * The replacement expression of this macro.
+ */
+ public CCodeExpression replacement_expression { get; set; }
+
+ public CCodeMacroReplacement (construct string! name, construct string! replacement) {
+ }
+
+ public CCodeMacroReplacement.with_expression (construct string! name, construct CCodeExpression! replacement_expression) {
}
-
+
public override void write (CCodeWriter! writer) {
writer.write_indent ();
writer.write_string ("#define ");
writer.write_string (name);
writer.write_string (" ");
- writer.write_string (replacement);
+ if (replacement != null) {
+ writer.write_string (replacement);
+ } else {
+ replacement_expression.write (writer);
+ }
writer.write_newline ();
}
}