From: Doni Pracner Date: Tue, 17 Jul 2018 23:50:47 +0000 (+0200) Subject: TransMessages improvements X-Git-Tag: v1.0.0~1 X-Git-Url: https://svarog.pmf.uns.ac.rs/gitweb/?a=commitdiff_plain;h=4c5bb3a3c316c483715e9fc50d9a2081d28cab0c;p=mjc2wsl.git TransMessages improvements --- diff --git a/src/com/quemaster/transformations/TransMessages.java b/src/com/quemaster/transformations/TransMessages.java index 042612f..bd27009 100644 --- a/src/com/quemaster/transformations/TransMessages.java +++ b/src/com/quemaster/transformations/TransMessages.java @@ -1,6 +1,6 @@ package com.quemaster.transformations; /* - Copyright (C) 2014 Doni Pracner + Copyright (C) 2014, 2018 Doni Pracner This file is part of mjc2wsl. @@ -29,8 +29,9 @@ public class TransMessages { private int[] messageCounters; public static final int M_DEB = 0; public static final int M_WAR = 1; - public static final int M_ERR = 2; - public static final int M_QUIET = 3; + public static final int M_NOTIFY = 2; + public static final int M_ERR = 5; + public static final int M_QUIET = 10; private PrintStream outStream = System.out; public TransMessages() { @@ -45,6 +46,10 @@ public class TransMessages { messageCounters[level]++; } + public void message(String string) { + message(string,M_NOTIFY); + } + public int getLevelMessageCount(int level){ if (level < messageCounters.length){ return messageCounters[level]; @@ -53,7 +58,11 @@ public class TransMessages { } public void printMessageCounters(PrintStream out){ - out.println("total errors:"+messageCounters[TransMessages.M_ERR]+" warnings:"+messageCounters[TransMessages.M_WAR]); + if (printLevel < M_QUIET) + out.println("total errors:" + messageCounters[TransMessages.M_ERR] + + " warnings:" + messageCounters[TransMessages.M_WAR] + + " notifications:" + messageCounters[TransMessages.M_NOTIFY] + ); } public void printMessageCounters(){ @@ -67,4 +76,5 @@ public class TransMessages { public void setPrintLevel(int printLevel) { this.printLevel = printLevel; } + } \ No newline at end of file diff --git a/src/com/quemaster/transformations/mjc2wsl/Mjc2wsl.java b/src/com/quemaster/transformations/mjc2wsl/Mjc2wsl.java index 6c3836e..d3f7297 100644 --- a/src/com/quemaster/transformations/mjc2wsl/Mjc2wsl.java +++ b/src/com/quemaster/transformations/mjc2wsl/Mjc2wsl.java @@ -374,6 +374,7 @@ public class Mjc2wsl{ int op = mjInput.get(); while (op >= 0) { + messages.message("Processing "+mjInput.describeOpCode(op)+ " at " + mjInput.getCounter(), TransMessages.M_DEB); prl(" a" + mjInput.getCounter() + " =="); if (originalInComments) prl(createComment(mjInput.describeOpCode(op), C_OC)); @@ -925,6 +926,9 @@ public class Mjc2wsl{ System.err.println("error in opening out file:"); e.printStackTrace(); } + if (i + 2 < args.length) { + messages.message("additional parameters ignored, starting from:'"+args[i+2]+"'", TransMessages.M_ERR); + } } if (out == null) { // if not set to screen, or a file, make a default filename @@ -944,7 +948,7 @@ public class Mjc2wsl{ } long mili = Calendar.getInstance().getTimeInMillis() - now.getTimeInMillis(); - System.out.println("conversion time:" + mili + " ms"); + messages.message("conversion time:" + mili + " ms"); messages.printMessageCounters(); out.close(); }