Skip to content

Commit 670c60e

Browse files
committed
CHJ: fix warnings and reformat
1 parent b491770 commit 670c60e

File tree

5 files changed

+119
-105
lines changed

5 files changed

+119
-105
lines changed
Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
(* =============================================================================
2-
CodeHawk C Analyzer
2+
CodeHawk C Analyzer
33
Author: Henny Sipma
44
------------------------------------------------------------------------------
55
The MIT License (MIT)
6-
7-
Copyright (c) 2005-2020 Kestrel Technology LLC
6+
7+
Copyright (c) 2005-2020 Kestrel Technology LLC
8+
Copyright (c) 2020-2024 Henny B. Sipma
89
910
Permission is hereby granted, free of charge, to any person obtaining a copy
1011
of this software and associated documentation files (the "Software"), to deal
1112
in the Software without restriction, including without limitation the rights
1213
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1314
copies of the Software, and to permit persons to whom the Software is
1415
furnished to do so, subject to the following conditions:
15-
16+
1617
The above copyright notice and this permission notice shall be included in all
1718
copies or substantial portions of the Software.
18-
19+
1920
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2021
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2122
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -38,64 +39,74 @@ open CHXmlDocument
3839

3940
(* jchlib *)
4041
open JCHBasicTypes
41-
open JCHBasicTypesAPI
42-
open JCHFile
4342
open JCHDictionary
4443

4544
(* jchpre *)
46-
open JCHApplication
4745
open JCHClassLoader
4846
open JCHIntegrateSummaries
49-
open JCHPreFileIO
5047
open JCHSystemSettings
5148

5249
let name = ref ""
53-
let target = ref ""
5450
let save_log = ref false
55-
51+
5652
let speclist =
57-
[ ("-classpath", Arg.String system_settings#add_classpath_unit,
58-
"sets java classpath");
59-
("-apis", Arg.String set_api_summary_classpath,
60-
"api-summary jar file");
61-
("-profiles", Arg.String set_profile_summary_classpath,
62-
"profile-summary jar file");
63-
("-supplements", Arg.String set_supplement_summary_classpath,
64-
"supplement-summary jar file");
65-
("-log",Arg.Set save_log,"save log file")
66-
]
67-
53+
[("-classpath", Arg.String system_settings#add_classpath_unit,
54+
"sets java classpath");
55+
("-apis", Arg.String set_api_summary_classpath,
56+
"api-summary jar file");
57+
("-profiles", Arg.String set_profile_summary_classpath,
58+
"profile-summary jar file");
59+
("-supplements", Arg.String set_supplement_summary_classpath,
60+
"supplement-summary jar file");
61+
("-log",Arg.Set save_log,"save log file")
62+
]
63+
6864
let usage_msg = "ch_integrate filename"
6965
let read_args () = Arg.parse speclist (fun s -> name := s) usage_msg
7066

67+
7168
let main () =
7269
try
7370
let _ = read_args () in
7471
let cn = make_cn !name in
7572
let _ = load_class_and_dependents cn in
7673
let logname = cn#name ^ "_integrate.chlog" in
7774
begin
78-
save_xml_class_or_interface_summary cn ;
75+
save_xml_class_or_interface_summary cn;
7976
file_output#saveFile logname chlog#toPretty
8077
end
8178
with
8279
| CHFailure p
8380
| JCH_failure p ->
8481
begin
85-
pr_debug [ STR "Error in chj_template: " ; p ] ;
82+
pr_debug [STR "Error in chj_template: "; p];
8683
exit 1
8784
end
8885
| CHXmlReader.XmlParseError (l,c,p) ->
8986
begin
90-
pr_debug [ NL ; STR "Xml parse error at (" ; INT l ; STR "," ;
91-
INT c ; STR "): " ; p ; NL ] ;
87+
pr_debug
88+
[NL;
89+
STR "Xml parse error at (";
90+
INT l;
91+
STR ",";
92+
INT c;
93+
STR "): ";
94+
p;
95+
NL];
9296
exit 1
9397
end
9498
| XmlDocumentError(line, col, p) ->
9599
begin
96-
pr_debug [ NL ; STR "XML document error at (" ; INT line;
97-
STR ","; INT col; STR "): "; p; NL] ;
100+
pr_debug [
101+
NL; STR "XML document error at (";
102+
INT line;
103+
STR ",";
104+
INT col;
105+
STR "): ";
106+
p;
107+
NL];
98108
exit 1
99109
end
100110

111+
101112
let _ = Printexc.print main ()

CodeHawk/CHJ/jchcmdline/jCHXNativeMethodSignatures.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,11 @@
3131
open CHCommon
3232
open CHPretty
3333

34-
(* chutil *)
35-
open CHLogger
36-
3734
(* jchlib *)
3835
open JCHBasicTypes
3936

4037
(* jchpre *)
4138
open JCHApplication
42-
open JCHCHAUtil
4339
open JCHNativeMethods
4440
open JCHSystemSettings
4541

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(* =============================================================================
2-
CodeHawk C Analyzer
2+
CodeHawk C Analyzer
33
Author: Henny Sipma
44
------------------------------------------------------------------------------
55
The MIT License (MIT)
6-
6+
77
Copyright (c) 2005-2020 Kestrel Technology LLC
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -12,10 +12,10 @@
1212
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1313
copies of the Software, and to permit persons to whom the Software is
1414
furnished to do so, subject to the following conditions:
15-
15+
1616
The above copyright notice and this permission notice shall be included in all
1717
copies or substantial portions of the Software.
18-
18+
1919
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2020
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2121
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -31,37 +31,38 @@
3131
open CHCommon
3232
open CHPretty
3333

34-
(* chutil *)
35-
open CHLogger
36-
3734
(* jchlib *)
3835
open JCHBasicTypes
39-
open JCHBasicTypesAPI
40-
open JCHFile
4136
open JCHDictionary
4237

4338
(* jchpre *)
44-
open JCHApplication
4539
open JCHClassLoader
46-
open JCHPreFileIO
4740
open JCHSystemSettings
4841

4942
let name = ref ""
5043
let target = ref ""
51-
44+
5245
let speclist =
53-
[("-classpath", Arg.String system_settings#add_classpath_unit,
46+
[("-classpath",
47+
Arg.String system_settings#add_classpath_unit,
5448
"sets java classpath");
55-
("-summaries", Arg.String system_settings#add_summary_classpath_unit,
49+
("-summaries",
50+
Arg.String system_settings#add_summary_classpath_unit,
5651
"summary jar file");
57-
("-api",Arg.Unit (fun () -> target := "api"),"create api summary") ;
58-
("-profile",Arg.Unit (fun () -> target := "profile"), "create profile summary");
59-
("-supplement",Arg.Unit (fun () -> target := "supplement"),"create supplement summary")
52+
("-api",
53+
Arg.Unit (fun () -> target := "api"),"create api summary");
54+
("-profile",
55+
Arg.Unit (fun () -> target := "profile"), "create profile summary");
56+
("-supplement",
57+
Arg.Unit (fun () -> target := "supplement"),
58+
"create supplement summary")
6059
]
61-
60+
61+
6262
let usage_msg = "mktemplate filename"
6363
let read_args () = Arg.parse speclist (fun s -> name := s) usage_msg
6464

65+
6566
let main () =
6667
try
6768
let _ = read_args () in
@@ -71,14 +72,20 @@ let main () =
7172
| "profile" -> JCHProfileSummaryTemplate.save_xml_class_or_interface_summary
7273
| "supplement" -> JCHSupplementSummary.save_xml_class_or_interface_summary
7374
| s ->
74-
raise (JCH_failure (LBLOCK [ STR "Target type " ; STR s ; STR " not recognized; " ;
75-
STR "valid commands are: api, profile, supplement" ])) in
75+
raise
76+
(JCH_failure
77+
(LBLOCK [
78+
STR "Target type ";
79+
STR s;
80+
STR " not recognized; ";
81+
STR "valid commands are: api, profile, supplement"])) in
7682
let cn = make_cn !name in
7783
let _ = load_class_and_dependents cn in
7884
cmd cn
7985
with
80-
CHFailure p
86+
| CHFailure p
8187
| JCH_failure p ->
82-
pr_debug [ STR "Error in chj_template: " ; p ]
88+
pr_debug [STR "Error in chj_template: "; p]
89+
8390

8491
let _ = Printexc.print main ()

CodeHawk/CHJ/jchstac/jCHXTemplate.ml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33
Author: Henny Sipma
44
------------------------------------------------------------------------------
55
The MIT License (MIT)
6-
7-
Copyright (c) 2005-2020 Kestrel Technology LLC
6+
7+
Copyright (c) 2005-2020 Kestrel Technology LLC
8+
Copyright (c) 2020-2024 Henny B. Sipma
89
910
Permission is hereby granted, free of charge, to any person obtaining a copy
1011
of this software and associated documentation files (the "Software"), to deal
1112
in the Software without restriction, including without limitation the rights
1213
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1314
copies of the Software, and to permit persons to whom the Software is
1415
furnished to do so, subject to the following conditions:
15-
16+
1617
The above copyright notice and this permission notice shall be included in all
1718
copies or substantial portions of the Software.
18-
19+
1920
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2021
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2122
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -33,33 +34,33 @@ open CHPretty
3334

3435
(* jchlib *)
3536
open JCHBasicTypes
36-
open JCHBasicTypesAPI
37-
open JCHFile
3837
open JCHDictionary
3938

4039
(* jchpre *)
41-
open JCHApplication
4240
open JCHClassLoader
43-
open JCHClassUserTemplate
4441
open JCHPreFileIO
4542
open JCHSystemSettings
4643

44+
4745
let name = ref ""
48-
let speclist = [("-classpath", Arg.String system_settings#add_classpath_unit,
49-
"sets java classpath") ]
50-
46+
let speclist = [
47+
("-classpath", Arg.String system_settings#add_classpath_unit,
48+
"sets java classpath") ]
49+
5150
let usage_msg = "chj_template filename"
5251
let read_args () = Arg.parse speclist (fun s -> name := s) usage_msg
5352

53+
5454
let main () =
5555
try
5656
let _ = read_args () in
5757
let cn = make_cn !name in
5858
let _ = load_class_and_dependents cn in
5959
save_xml_user_class_template_file cn
6060
with
61-
CHFailure p
62-
| JCH_failure p ->
63-
pr_debug [ STR "Error in chj_template: " ; p ]
61+
| CHFailure p
62+
| JCH_failure p ->
63+
pr_debug [STR "Error in chj_template: "; p]
64+
6465

6566
let _ = Printexc.print main ()

0 commit comments

Comments
 (0)