From 024901670ee2bd32910d398c4a80258307f5ecb4 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Sat, 12 Jan 2013 02:37:21 +0100 Subject: wixl: implement preprocessor undef --- tools/wixl/preprocessor.vala | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'tools') 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 includedirs; - HashTable globals; HashTable variables; construct { variables = new HashTable (str_hash, str_equal); } public Preprocessor (HashTable globals, List includedirs) { - this.globals = globals; + string name, value; + var it = HashTableIter (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; -- cgit