Mercurial > hg > octave-lyh
comparison scripts/java/javaclasspath.m @ 15748:54e8c2527a9e
style and doc fixes for newly imported Java package .m files
* java/cell2mlstr.m, java/errordlg.m, java/helpdlg.m, java/inputdlg.m,
java/javaArray.m, java/javaaddpath.m, java/javaclasspath.m,
java/javafields.m, java/javamem.m, java/javamethods.m,
java/javarmpath.m, java/listdlg.m, java/msgbox.m java/questdlg.m,
java/warndlg.m: Style and doc fixes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 07 Dec 2012 17:21:27 -0500 |
parents | da26f72408a7 |
children | 05c781cca57e |
comparison
equal
deleted
inserted
replaced
15747:4be890c5527c | 15748:54e8c2527a9e |
---|---|
16 ## You should have received a copy of the GNU General Public License | 16 ## You should have received a copy of the GNU General Public License |
17 ## along with Octave; see the file COPYING. If not, see | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | 18 ## <http://www.gnu.org/licenses/>. |
19 | 19 |
20 ## -*- texinfo -*- | 20 ## -*- texinfo -*- |
21 ## @deftypefn {Function file} {} javaclasspath | 21 ## @deftypefn {Function file} {} javaclasspath () |
22 ## @deftypefnx {Function file} {@var{STATIC} =} javaclasspath | 22 ## @deftypefnx {Function file} {@var{static} =} javaclasspath () |
23 ## @deftypefnx {Function file} {[@var{STATIC}, @var{DYNAMIC}] =} javaclasspath | 23 ## @deftypefnx {Function file} {[@var{static}, @var{dynamic}] =} javaclasspath () |
24 ## @deftypefnx {Function file} {@var{PATH} =} javaclasspath (@var{WHAT}) | 24 ## @deftypefnx {Function file} {@var{path} =} javaclasspath (@var{what}) |
25 ## | 25 ## Return the class path of the Java virtual machine in |
26 ## Returns the class path of the Java virtual machine in | |
27 ## the form of a cell array of strings. | 26 ## the form of a cell array of strings. |
28 ## | 27 ## |
29 ## If called without input parameter:@* | 28 ## If called without input parameter:@* |
30 ## @itemize | 29 ## @itemize |
31 ## @item If no output variable is given, the result is simply printed | 30 ## @item If no output is requested, the result is simply printed |
32 ## on the standard output. | 31 ## on the standard output. |
33 ## @item If one output variable @var{STATIC} is given, the result is | 32 ## @item If one output value @var{STATIC} is requested, the result is |
34 ## the static classpath. | 33 ## the static classpath. |
35 ## @item If two output variables @var{STATIC} and @var{DYNAMIC} are | 34 ## @item If two output values@var{STATIC} and @var{DYNAMIC} are |
36 ## given, the first variable will contain the static classpath, | 35 ## requested, the first variable will contain the static classpath, |
37 ## the second will be filled with the dynamic claspath. | 36 ## the second will be filled with the dynamic classpath. |
38 ## @end itemize | 37 ## @end itemize |
39 ## | 38 ## |
40 ## If called with a single input parameter @var{WHAT}:@* | 39 ## If called with a single input parameter @var{what}:@* |
41 ## @itemize | 40 ## @itemize |
42 ## @item If @var{WHAT} is '-static' the static classpath is returned. | 41 ## @item If @var{what} is @code{"-static"} return the static classpath |
43 ## @item If @var{WHAT} is '-dynamic' the dynamic classpath is returned. | 42 ## @item If @var{what} is @code{"-dynamic"} return the dynamic classpath |
44 ## @item If @var{WHAT} is '-all' the static and the dynamic classpath | 43 ## @item If @var{what} is @code{"-all"} return both the static and |
45 ## are returned in a single cell array | 44 ## dynamic classpath |
46 ## @end itemize | 45 ## @end itemize |
46 ## @seealso{javaaddpath, javarmpath} | |
47 ## @end deftypefn | 47 ## @end deftypefn |
48 ## @seealso{javaaddpath,javarmpath} | |
49 | 48 |
50 function varargout = javaclasspath (which) | 49 function varargout = javaclasspath (which) |
51 | 50 |
52 % dynamic classpath | 51 ## dynamic classpath |
53 dynamic_path = java_invoke ("org.octave.ClassHelper", "getClassPath"); | 52 dynamic_path = java_invoke ("org.octave.ClassHelper", "getClassPath"); |
54 dynamic_path_list = strsplit (dynamic_path, pathsep ()); | 53 dynamic_path_list = strsplit (dynamic_path, pathsep ()); |
55 | 54 |
56 % static classpath | 55 ## static classpath |
57 static_path = java_invoke ('java.lang.System', 'getProperty', 'java.class.path'); | 56 static_path = java_invoke ("java.lang.System", "getProperty", "java.class.path"); |
58 static_path_list = strsplit (static_path, pathsep ()); | 57 static_path_list = strsplit (static_path, pathsep ()); |
59 if (length (static_path_list) > 1) | 58 if (numel (static_path_list) > 1) |
60 % remove first element (which is .../octave.jar) | 59 ## remove first element (which is .../octave.jar) |
61 static_path_list = static_path_list(2:length (static_path_list)); | 60 static_path_list = static_path_list(2:numel (static_path_list)); |
62 else | 61 else |
63 static_path_list = {}; | 62 static_path_list = {}; |
64 end | 63 endif |
65 | 64 |
66 switch nargin | 65 switch nargin |
67 case 0 | 66 case 0 |
68 switch nargout | 67 switch nargout |
69 case 0 | 68 case 0 |
70 disp_path_list ( 'STATIC', static_path_list ) | 69 disp_path_list ( "STATIC", static_path_list ) |
71 disp(''); | 70 disp (""); |
72 disp_path_list ( 'DYNAMIC', dynamic_path_list ) | 71 disp_path_list ( "DYNAMIC", dynamic_path_list ) |
72 | |
73 case 1 | 73 case 1 |
74 varargout{1} = cellstr (dynamic_path_list); | 74 varargout{1} = cellstr (dynamic_path_list); |
75 | |
75 case 2 | 76 case 2 |
76 varargout{1} = cellstr (dynamic_path_list); | 77 varargout{1} = cellstr (dynamic_path_list); |
77 varargout{2} = cellstr (static_path_list); | 78 varargout{2} = cellstr (static_path_list); |
78 endswitch | 79 endswitch |
79 | 80 |
80 case 1 | 81 case 1 |
81 switch nargout | 82 switch nargout |
82 case 0 | 83 case 0 |
83 if (strcmp (which, '-static') == 1) | 84 if (strcmp (which, "-static") == 1) |
84 disp_path_list ( 'STATIC', static_path_list ) | 85 disp_path_list ( "STATIC", static_path_list ) |
85 elseif (strcmp (which, '-dynamic') == 1) | 86 elseif (strcmp (which, "-dynamic") == 1) |
86 disp_path_list ( 'DYNAMIC', dynamic_path_list ) | 87 disp_path_list ( "DYNAMIC", dynamic_path_list ) |
87 end | 88 endif |
89 | |
88 case 1 | 90 case 1 |
89 if (strcmp (which, '-static') == 1) | 91 if (strcmp (which, "-static") == 1) |
90 varargout{1} = cellstr (static_path_list); | 92 varargout{1} = cellstr (static_path_list); |
91 elseif (strcmp (which, '-dynamic') == 1) | 93 elseif (strcmp (which, "-dynamic") == 1) |
92 varargout{1} = cellstr (dynamic_path_list); | 94 varargout{1} = cellstr (dynamic_path_list); |
93 elseif (strcmp (which, '-all') == 1) | 95 elseif (strcmp (which, "-all") == 1) |
94 varargout{1} = cellstr ([static_path_list, dynamic_path_list]); | 96 varargout{1} = cellstr ([static_path_list, dynamic_path_list]); |
95 end | 97 endif |
96 endswitch | 98 endswitch |
97 endswitch | 99 endswitch |
98 | 100 |
99 end | 101 endfunction |
100 # | 102 |
101 # Display cell array of paths | 103 ## Display cell array of paths |
102 # | 104 |
103 function disp_path_list ( which, path_list ) | 105 function disp_path_list ( which, path_list ) |
104 printf (' %s JAVA PATH\n\n', which); | 106 printf (" %s JAVA PATH\n\n", which); |
105 if (length (path_list) > 0) | 107 if (length (path_list) > 0) |
106 printf (' %s\n', path_list{:}); | 108 printf (" %s\n", path_list{:}); |
107 else | 109 else |
108 printf (' - empty -\n'); | 110 printf (" - empty -\n"); |
109 endif | 111 endif |
110 end | 112 endfunction |