summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-12 02:37:21 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-15 16:24:44 +0100
commit024901670ee2bd32910d398c4a80258307f5ecb4 (patch)
treed3d010e564bfce849314e804c12816f8ef5284fb /tools
parent44624ba935aee3b8559ec8309331bda3ea37879c (diff)
downloadmsitools-024901670ee2bd32910d398c4a80258307f5ecb4.tar.gz
msitools-024901670ee2bd32910d398c4a80258307f5ecb4.tar.xz
msitools-024901670ee2bd32910d398c4a80258307f5ecb4.zip
wixl: implement preprocessor undef
Diffstat (limited to 'tools')
-rw-r--r--tools/wixl/preprocessor.vala17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/wixl/preprocessor.vala b/tools/wixl/preprocessor.vala
index d00e705..fe75244 100644
--- a/tools/wixl/preprocessor.vala
+++ b/tools/wixl/preprocessor.vala
@@ -3,14 +3,17 @@ namespace Wixl {
class Preprocessor: Object {
unowned List<File> includedirs;
- HashTable<string, string> globals;
HashTable<string, string> variables;
construct {
variables = new HashTable<string, string> (str_hash, str_equal);
}
public Preprocessor (HashTable<string, string> globals, List<File> includedirs) {
- this.globals = globals;
+ string name, value;
+ var it = HashTableIter <string, string> (globals);
+ while (it.next (out name, out value))
+ define_variable (name, value);
+
this.includedirs = includedirs;
}
@@ -18,8 +21,12 @@ namespace Wixl {
variables.insert (name, value);
}
+ public void undefine_variable (string name) {
+ variables.remove (name);
+ }
+
public string? lookup_variable (string name) {
- return variables.lookup (name) ?? globals.lookup (name);
+ return variables.lookup (name);
}
public string eval_variable (string str, File? file, bool needed = true) throws GLib.Error {
@@ -188,6 +195,10 @@ namespace Wixl {
} else
throw new Wixl.Error.FAILED ("invalid define");
break;
+ case "undef":
+ var value = reader.const_value ().strip ();
+ undefine_variable (value);
+ break;
case "include":
var value = eval (reader.const_value (), file).strip ();
var success = false;