gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
mjc2wsl - more detail to the messages system, add command line options and the help...
[mjc2wsl.git] / src / mjc2wsl.java
index ecf634a..574adcc 100644 (file)
@@ -12,14 +12,14 @@ import java.util.*;
 public class mjc2wsl{
        public static String versionN = "0.1.2";
 
 public class mjc2wsl{
        public static String versionN = "0.1.2";
 
-       public static final int M_ERR = 2, M_WAR = 1;
+       public static final int M_ERR = 2, M_WAR = 1, M_DEB = 0;
        
        
-       private int printLevel = 0;
+       private int printLevel = M_ERR;
        
        private int[] messageCounters = new int[M_ERR+1];
        
        private void message(String mes, int level){
        
        private int[] messageCounters = new int[M_ERR+1];
        
        private void message(String mes, int level){
-                       if (level>printLevel)
+                       if (level>=printLevel)
                                        System.out.println(mes);
                        messageCounters[level]++;
        }
                                        System.out.println(mes);
                        messageCounters[level]++;
        }
@@ -379,6 +379,9 @@ public class mjc2wsl{
                System.out.println("usage:\n\t {options} mjc2wsl  filename [outfile]");
                System.out.println("options:\n\t--screen print output to screen");
                System.out.println("\t-o --oc[+-] include original code in comments");
                System.out.println("usage:\n\t {options} mjc2wsl  filename [outfile]");
                System.out.println("options:\n\t--screen print output to screen");
                System.out.println("\t-o --oc[+-] include original code in comments");
+               System.out.println("\t-v verbose, print warning messages");
+               System.out.println("\t-q don't print even the error messages");
+               System.out.println("\t-d print detailed debug messages");
        }
        
        public String makeDefaultOutName(String inname){
        }
        
        public String makeDefaultOutName(String inname){
@@ -407,6 +410,12 @@ public class mjc2wsl{
                                                originalInComments = true;
                                } else if (args[i].startsWith("--screen")) {
                                        out = new PrintWriter(System.out);
                                                originalInComments = true;
                                } else if (args[i].startsWith("--screen")) {
                                        out = new PrintWriter(System.out);
+                               } else if (args[i].compareTo("-d") == 0) {
+                                       printLevel = M_DEB;//print debug info
+                               } else if (args[i].compareTo("-v") == 0) {
+                                       printLevel = M_WAR;//print warnings
+                               } else if (args[i].compareTo("-q") == 0) {
+                                       printLevel = M_ERR+1;//no printing
                                }
                                i++;
                        }
                                }
                                i++;
                        }
@@ -436,7 +445,6 @@ public class mjc2wsl{
                        }
                        if (f.exists()) {
                                Calendar now = Calendar.getInstance();
                        }
                        if (f.exists()) {
                                Calendar now = Calendar.getInstance();
-                               printLevel=10;
                                convertFile(f);
                                long mili = Calendar.getInstance().getTimeInMillis()
                                                - now.getTimeInMillis();
                                convertFile(f);
                                long mili = Calendar.getInstance().getTimeInMillis()
                                                - now.getTimeInMillis();
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner