From: <prn...@us...> - 2011-05-16 21:55:51
|
Revision: 8268 http://octave.svn.sourceforge.net/octave/?rev=8268&view=rev Author: prnienhuis Date: 2011-05-16 21:55:44 +0000 (Mon, 16 May 2011) Log Message: ----------- Added missing "end %if"; improved reference to Java pkg install dir in Java section; adapted unojarpath to distinguish between Windows 7 *nix OOo installations (esp. URE subdir tree) Modified Paths: -------------- trunk/octave-forge/main/io/inst/chk_spreadsheet_support.m Modified: trunk/octave-forge/main/io/inst/chk_spreadsheet_support.m =================================================================== --- trunk/octave-forge/main/io/inst/chk_spreadsheet_support.m 2011-05-16 21:50:59 UTC (rev 8267) +++ trunk/octave-forge/main/io/inst/chk_spreadsheet_support.m 2011-05-16 21:55:44 UTC (rev 8268) @@ -63,9 +63,12 @@ % '' Improved finding jar names in javaclasspath % 2011-05-07 Improved help text % 2011-05-15 Better error msg if OOo instal dir isn't found +% 2011-05-16 Added missing end %if +% '' Improved java pkg install dir for Octave +% '' Distinguish URE subdir tree buildup between *nix & Windows OOo install jcp = []; retval = 0; - if (nargin < 2), dbug = 0; end %if + if (nargin < 2), dbug = 0; path_to_ooo = []; end %if isOctave = exist ('OCTAVE_VERSION', 'builtin') ~= 0; if (ispc), filesep = '\'; else, filesep = '/'; end %if fprintf ('\n'); @@ -83,7 +86,7 @@ catch % COM not supported if (dbug), fprintf ('not working.\n\n'); end %if - end %try_catch + end %try_catch % Check Java if (dbug), fprintf ('Checking Java support...\n'); end %if @@ -135,14 +138,16 @@ % Check JVM virtual memory settings jrt = javaMethod ('getRuntime', 'java.lang.Runtime'); jmem = jrt.maxMemory (); - if (isOctave), jmem = jmem.doubleValue(); end %if + if (isOctave), jmem = jmem.doubleValue(); end %if jmem = int16 (jmem/1024/1024); fprintf (' Maximum JVM memory: %5d MiB; ', jmem); if (jmem < 400) fprintf ('should better be at least 400 MB!\n'); fprintf (' Hint: adapt setting -Xmx in file "java.opts" (supposed to be here:)\n'); if (isOctave) - fprintf (' %s\n', [matlabroot filesep 'share' filesep 'octave' filesep 'packages' filesep 'java-<version>' filesep 'java.opts']); + tmp = eval ("which javaclasspath"); + jidx = strfind (tmp, filesep); + fprintf (' %s\n', tmp(jidx(1) : jidx(end))); else fprintf (' $matlabroot/bin/<arch>]\n'); end %if @@ -151,7 +156,7 @@ end %if end %if if (dbug), fprintf ('Java support OK\n'); end %if - catch + catch error ('No Java support found.'); end %try_catch @@ -159,7 +164,7 @@ % Try Java & UNO if (dbug > 1), fprintf ('UNO/Java (.ods, .xls, .xlsx, .sxc) <OpenOffice.org>:\n'); end %if - # entries0(1) = not a jar but a directory (<000_install_dir/program/>) + % entries0(1) = not a jar but a directory (<000_install_dir/program/>) jpchk = 0; entries0 = {'program', 'unoil', 'jurt', 'juh', 'unoloader', 'ridl'}; missing0 = zeros (1, numel (entries0)); % Only under *nix we might use brute force: e.g., strfind (javaclasspath, classname) @@ -375,7 +380,7 @@ end %if end %if - # If requested, try to add UNO stuff to javaclasspath + % If requested, try to add UNO stuff to javaclasspath ujars_complete = isempty (find (missing0)); if (dbug > 1) if (ujars_complete) @@ -385,15 +390,16 @@ end %if end %if - if (~ujars_complete && nargin > 0 && ~isempty (path_to_ooo)) + if (~ujars_complete && nargin > 2 && ~isempty (path_to_ooo)) if (dbug), fprintf ('Trying to add missing UNO java class libs to javaclasspath...\n'); end %if if (~ischar (path_to_jars)), error ('Path expected for arg # 1'); end %if % Add missing jars to javaclasspath. First combine all entries targt = sum (missing0); if (missing0(1)) - # Add program dir (= where soffice or soffice.exe or ooffice resides) + % Add program dir (= where soffice or soffice.exe or ooffice resides) programdir = [path_to_ooo filesep entries0{1}]; - if (fexist (programdir, 'd')) + if (exist (programdir, 'dir') == 7) +% if (fexist (programdir, 'd')) if (dbug > 2), fprintf (' Found %s, adding it to javaclasspath ... ', programdir); end %if try javaaddpath (programdir); @@ -409,37 +415,41 @@ % Rest of missing entries. Find where URE is located uredirlst = dir ([path_to_ooo]); jj = 1; - while (jj < size (uredirlst, 1) && jj > 0) + while (jj <= size (uredirlst, 1) && jj > 0) uredir = uredirlst(jj).name; if (uredirlst(jj).isdir && ~isempty (strfind (lower (uredirlst(jj).name), 'ure'))) uredir = uredirlst(jj).name; jj = 0; else ++jj; - endif - endwhile - # Now search for UNO jars + end %if + end %while + % Now search for UNO jars for ii=2:length (entries0) if (missing0(ii)) if (ii == 2) - # Special case as unoil.jar usuaally resides in ./Basis.../program/classes - # Find out the exact name of Basis..... + % Special case as unoil.jar usuaally resides in ./Basis.../program/classes + % Find out the exact name of Basis..... basisdirlst = dir ([path_to_ooo filesep 'basis' '*']); jj = 1; while (jj < size (basisdirlst, 1) && jj > 0) - # basisdir = basisdirlst(jj).name; + % basisdir = basisdirlst(jj).name; if (basisdirlst(jj).isdir) basisdir = basisdirlst(jj).name; jj = 0; else ++jj; - endif - endwhile - unojarpath = [ path_to_ooo filesep basisdir filesep 'program' filesep 'classes' filesep ] + end %if + end %while + unojarpath = [ path_to_ooo filesep basisdir filesep 'program' filesep 'classes' filesep ]; file = dir ([ unojarpath entries0{ii} '*' ]); else - # Rest of jars in ./ure/share/java (case not sure) - unojarpath = [ path_to_ooo filesep uredir filesep 'java' filesep ]; + % Rest of jars in ./ure/share/java (case not sure) + if (ispc) + unojarpath = [ path_to_ooo filesep uredir filesep 'java' filesep ]; + else + unojarpath = [ path_to_ooo filesep uredir filesep 'share' filesep 'java' filesep ] + end %if file = dir ([unojarpath entries0{ii} '*']); end %if if (isempty (file)) @@ -452,7 +462,7 @@ if (dbug > 2), fprintf ('OK\n'); end %if catch if (dbug > 2), fprintf ('FAILED\n'); end %if - end %try_catch + end %try_catch end %if end %if end %for @@ -462,10 +472,11 @@ else fprintf ('All interfaces fully supported.now.\n\n'); retval = 1; + end %if end %f end %if - # Rest of Java interfaces + % Rest of Java interfaces missing = [missing1 missing2 missing3 missing4 missing5 missing6]; jars_complete = isempty (find (missing)); if (dbug) @@ -496,7 +507,7 @@ if (dbug > 2), fprintf ('OK\n'); end %if catch if (dbug > 2), fprintf ('FAILED\n'); end %if - end% try_catch + end% try_catch end %if end %if end %for This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |