summaryrefslogtreecommitdiffstats
path: root/tools/wixl
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-11 17:26:56 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-11 17:26:56 +0100
commit7906f5f165351ba499733f1bf91d8421d43f9cc3 (patch)
tree3422b3c6f8331c60b7ab532a5f8b34a51e325b84 /tools/wixl
parent752499c724ebbcfda5de804209b5fec926b80650 (diff)
downloadmsitools-7906f5f165351ba499733f1bf91d8421d43f9cc3.tar.gz
msitools-7906f5f165351ba499733f1bf91d8421d43f9cc3.tar.xz
msitools-7906f5f165351ba499733f1bf91d8421d43f9cc3.zip
wixl: print preprocessor location on warning/error
Diffstat (limited to 'tools/wixl')
-rw-r--r--tools/wixl/preprocessor.vala28
1 files changed, 26 insertions, 2 deletions
diff --git a/tools/wixl/preprocessor.vala b/tools/wixl/preprocessor.vala
index 460f46b..2d87b21 100644
--- a/tools/wixl/preprocessor.vala
+++ b/tools/wixl/preprocessor.vala
@@ -75,8 +75,30 @@ namespace Wixl {
return result + str[end:str.length];
}
+ class Location: Object {
+ File file;
+ int line;
+
+ public Location (Xml.TextReader reader, File file) {
+ this.file = file;
+ var node = reader.current_node ();
+ this.line = node->line;
+ }
+
+ public string to_string () {
+ return "%s:%d".printf (file.get_basename (), line);
+ }
+ }
+
+ void print (string prefix, Location loc, string msg) {
+ stderr.printf (loc.to_string () + ": " + prefix + ": " + msg + "\n");
+ }
+
+
void preprocess_xml (Xml.TextReader reader, Xml.TextWriter writer, File? file, bool is_include = false) throws GLib.Error {
while (reader.read () > 0) {
+ var loc = new Location (reader, file);
+
switch (reader.node_type ()) {
case Xml.ReaderType.PROCESSING_INSTRUCTION:
switch (reader.const_local_name ()) {
@@ -99,10 +121,12 @@ namespace Wixl {
break;
break;
case "warning":
- warning (eval (reader.const_value (), file));
+ print ("warning", loc, eval (reader.const_value (), file));
break;
case "error":
- error (eval (reader.const_value (), file));
+ print ("error", loc, eval (reader.const_value (), file));
+ Posix.exit (1);
+ break;
default:
warning ("unhandled preprocessor instruction %s", reader.const_local_name ());
break;