annotate scripts/java/javaclasspath.m @ 29358:0a5b15007766 stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2021 09:52:15 -0500
parents bd51beb6205e
children 7854d5752dd2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
3 ## Copyright (C) 2007-2021 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
15746
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
7 ##
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
8 ## This file is part of Octave.
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
15746
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 ##
15746
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 ##
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
15746
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20160
diff changeset
27 ## @deftypefn {} {} javaclasspath ()
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20160
diff changeset
28 ## @deftypefnx {} {@var{dpath} =} javaclasspath ()
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20160
diff changeset
29 ## @deftypefnx {} {[@var{dpath}, @var{spath}] =} javaclasspath ()
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20160
diff changeset
30 ## @deftypefnx {} {@var{clspath} =} javaclasspath (@var{what})
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
31 ## Return the class path of the Java virtual machine in the form of a cell
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
32 ## array of strings.
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
33 ##
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
34 ## If called with no inputs:
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 ##
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 ## @itemize
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19596
diff changeset
37 ## @item If no output is requested, the dynamic and static classpaths are
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19596
diff changeset
38 ## printed to the standard output.
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
39 ##
20160
03b9d17a2d95 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
40 ## @item If one output value @var{dpath} is requested, the result is the
03b9d17a2d95 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
41 ## dynamic classpath.
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
42 ##
20160
03b9d17a2d95 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
43 ## @item If two output values@var{dpath} and @var{spath} are requested, the
03b9d17a2d95 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
44 ## first variable will contain the dynamic classpath and the second will
03b9d17a2d95 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
45 ## contain the static classpath.
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 ## @end itemize
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
47 ##
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
48 ## If called with a single input parameter @var{what}:
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
49 ##
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
50 ## @table @asis
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 16724
diff changeset
51 ## @item @qcode{"-dynamic"}
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
52 ## Return the dynamic classpath.
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
53 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 16724
diff changeset
54 ## @item @qcode{"-static"}
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
55 ## Return the static classpath.
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
56 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 16724
diff changeset
57 ## @item @qcode{"-all"}
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
58 ## Return both the static and dynamic classpath in a single cellstr.
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
59 ## @end table
15748
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
60 ## @seealso{javaaddpath, javarmpath}
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 ## @end deftypefn
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62
22765
01aae08a0105 maint: Rename variables to match documentation in m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
63 function [path1, path2] = javaclasspath (what = "")
18903
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
64
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
65 if (nargin > 1)
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
66 print_usage ();
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
67 endif
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68
15748
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
69 ## dynamic classpath
15790
921912c92102 Deprecate java_invoke, replace with javaMethod.
Rik <rik@octave.org>
parents: 15772
diff changeset
70 dynamic_path = javaMethod ("getClassPath", "org.octave.ClassHelper");
16724
b7667fcb9fbc Substitute ostrsplit() for strsplit().
Ben Abbott <bpabbott@mac.com>
parents: 16403
diff changeset
71 dynamic_path_list = ostrsplit (dynamic_path, pathsep ());
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72
15748
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
73 ## static classpath
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19596
diff changeset
74 static_path = javaMethod ("getProperty",
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19596
diff changeset
75 "java.lang.System", "java.class.path");
16724
b7667fcb9fbc Substitute ostrsplit() for strsplit().
Ben Abbott <bpabbott@mac.com>
parents: 16403
diff changeset
76 static_path_list = ostrsplit (static_path, pathsep ());
15748
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
77 if (numel (static_path_list) > 1)
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
78 ## remove first element (which is .../octave.jar)
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15750
diff changeset
79 static_path_list(1) = [];
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 else
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 static_path_list = {};
15748
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
82 endif
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83
18903
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
84 if (nargout == 0)
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
85 if (! nargin)
22765
01aae08a0105 maint: Rename variables to match documentation in m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
86 what = "-all";
18903
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
87 endif
22765
01aae08a0105 maint: Rename variables to match documentation in m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
88 switch (tolower (what))
18903
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
89 case "-dynamic", disp_path_list ("DYNAMIC", dynamic_path_list);
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
90 case "-static", disp_path_list ("STATIC", static_path_list);
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
91 case "-all"
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
92 disp_path_list ("STATIC", static_path_list);
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
93 disp ("");
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
94 disp_path_list ("DYNAMIC", dynamic_path_list);
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
95 otherwise
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
96 error ("javaclasspath: invalid value for WHAT");
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
97 endswitch
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
98
18903
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
99 else
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
100 if (! nargin)
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
101 ## This is to allow retrieval of both paths in separate variables with
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21634
diff changeset
102 ## a single call to javaclasspath(). Matlab returns only the -dynamic
18903
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
103 ## path in this case but this won't break compatibility.
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
104 path1 = cellstr (dynamic_path_list);
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
105 path2 = cellstr (static_path_list);
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
106 else
22765
01aae08a0105 maint: Rename variables to match documentation in m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
107 switch (tolower (what))
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19596
diff changeset
108 case "-all", path1 = cellstr ([static_path_list,dynamic_path_list]);
18903
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
109 case "-dynamic", path1 = cellstr (dynamic_path_list);
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
110 case "-static", path1 = cellstr (static_path_list);
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
111 otherwise
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
112 error ("javaclasspath: invalid value for WHAT");
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113 endswitch
18903
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
114 endif
93805f9256a9 javaclasspath: refactor to avoid duplication and skip check of nargout.
Carnë Draug <carandraug@octave.org>
parents: 17744
diff changeset
115 endif
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
116
15748
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
117 endfunction
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
118
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
119 ## Display cell array of paths
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
120
22765
01aae08a0105 maint: Rename variables to match documentation in m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
121 function disp_path_list (what, path_list)
01aae08a0105 maint: Rename variables to match documentation in m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
122 printf (" %s JAVA PATH\n\n", what);
15750
05c781cca57e use numel instead of length in newly imported java functions
John W. Eaton <jwe@octave.org>
parents: 15748
diff changeset
123 if (numel (path_list) > 0)
21634
96518f623c91 Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents: 21633
diff changeset
124 printf (" %s\n", path_list{:});
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125 else
21634
96518f623c91 Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents: 21633
diff changeset
126 printf (" - empty -\n");
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 endif
15748
54e8c2527a9e style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents: 15746
diff changeset
128 endfunction