gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
wsl scripts, new ARGV handling
[mjc2wsl.git] / src-wsl / metrics.wsl
index 1eeceee..b73a466 100644 (file)
@@ -1,3 +1,22 @@
+C:"Doni Pracner (c) 2015";
+C:"
+This program is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 3 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more
+details.
+
+You should have received a copy of the GNU General Public
+License along with this program. If not, see
+<http://www.gnu.org/licenses/>.
+==========================================================";
+
 C:"This program generates metrics for WSL programs,
 including options for comparing two programs (mainly ment to
 compare different versions) and output differences as direct
 C:"This program generates metrics for WSL programs,
 including options for comparing two programs (mainly ment to
 compare different versions) and output differences as direct
@@ -8,10 +27,6 @@ command line for quick checks but also to be used for
 automation and creation of CSV files for collections of
 programs.";
 
 automation and creation of CSV files for collections of
 programs.";
 
-C:"Doni Pracner (c) 2015";
-
-C:"Released under the terms of the GPL v3 or later";
-
 C:"usage {option} {filename}";
 
 C:"Options";
 C:"usage {option} {filename}";
 
 C:"Options";
@@ -42,24 +57,6 @@ C:"examples;
        files in the specified file
 ";
 
        files in the specified file
 ";
 
-C:"
-This program is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public
-License as published by the Free Software Foundation; either
-version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied
-warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more
-details.
-
-You should have received a copy of the GNU General Public
-License along with this program. If not, see
-<http://www.gnu.org/licenses/>.
-==========================================================";
-
 Field_Separator := ",";
 
 MW_PROC @Get_New_Name(VAR str) == 
 Field_Separator := ",";
 
 MW_PROC @Get_New_Name(VAR str) == 
@@ -94,14 +91,14 @@ MW_PROC @Write_Metrics(metrics VAR) ==
                        OD
 END;
 
                        OD
 END;
 
-MW_PROC @Write_Metrics_List() ==
-                       @WS("McCabe Cyclo");@WS(Field_Separator);
-                       @WS("McCabe Essential");@WS(Field_Separator);
-                       @WS("Statements");@WS(Field_Separator);
-                       @WS("Expressions");@WS(Field_Separator);
-                       @WS("CFDF");@WS(Field_Separator);
-                       @WS("Size");@WS(Field_Separator);
-                       @WS("Structure")
+MW_PROC @Write_Metrics_List(prefix VAR) ==
+                       @WS(prefix);@WS("McCabe Cyclo");@WS(Field_Separator);
+                       @WS(prefix);@WS("McCabe Essential");@WS(Field_Separator);
+                       @WS(prefix);@WS("Statements");@WS(Field_Separator);
+                       @WS(prefix);@WS("Expressions");@WS(Field_Separator);
+                       @WS(prefix);@WS("CFDF");@WS(Field_Separator);
+                       @WS(prefix);@WS("Size");@WS(Field_Separator);
+                       @WS(prefix);@WS("Structure")
 END;
 
 MW_PROC @Metrics_Main() ==
 END;
 
 MW_PROC @Metrics_Main() ==
@@ -109,7 +106,7 @@ VAR< prog := < >,
        filename:="", filename2 := "",
        metrics := < >, met2 := < >,
        opened := 0,
        filename:="", filename2 := "",
        metrics := < >, met2 := < >,
        opened := 0,
-       Argv := @Argv 
+       Argv := ARGV 
 >:
 C:"First one is the script name that is being executed";
 Argv := TAIL(Argv);
 >:
 C:"First one is the script name that is being executed";
 Argv := TAIL(Argv);
@@ -125,15 +122,15 @@ ELSE
                        SKIP
                ELSIF filename = "-H" OR filename = "--header" THEN
                        @WS("filename");@WS(Field_Separator);
                        SKIP
                ELSIF filename = "-H" OR filename = "--header" THEN
                        @WS("filename");@WS(Field_Separator);
-                       @Write_Metrics_List();
+                       @Write_Metrics_List("");
                        @WL("");
                ELSIF filename = "-HC" THEN
                        C:"Header for comparison";
                        @WS("filename");@WS(Field_Separator);
                        @WL("");
                ELSIF filename = "-HC" THEN
                        C:"Header for comparison";
                        @WS("filename");@WS(Field_Separator);
-                       @Write_Metrics_List();@WS(Field_Separator);
-                       @Write_Metrics_List();@WS(Field_Separator);
-                       @WS("DIF");@Write_Metrics_List();@WS(Field_Separator);
-                       @WS("%");@Write_Metrics_List();
+                       @Write_Metrics_List("P1-");@WS(Field_Separator);
+                       @Write_Metrics_List("P2-");@WS(Field_Separator);
+                       @Write_Metrics_List("DIFF-");@WS(Field_Separator);
+                       @Write_Metrics_List("%-");
                        @WL("");
                ELSIF filename = "-o" THEN
                        C:"set output";
                        @WL("");
                ELSIF filename = "-o" THEN
                        C:"set output";
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner