PageRenderTime 188ms CodeModel.GetById 178ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-1-pre5/jedit.cmd

#
Batch | 73 lines | 61 code | 12 blank | 0 comment | 7 complexity | c23e5250c60e98cd2825ba23f8089d8b MD5 | raw file
 1/* MAINTAINERS: Robert Henschel (os2info@gmx.net)
 2 *              Christoph vogt (ch.vogt@gmx.net)
 3 *              Gili Tzabari (junk@bbs.darktech.org)
 4 * PLATFORM: OS/2, eCS
 5 * 
 6 * Used to run JEdit 3.1
 7 */
 8
 9
10rc = QueryJavaVersion()
11if (rc = -1) then
12do
13  say "java.exe cannot be found"
14  return -1;
15end
16if (rc = -2) then
17  say "Unexpected response to JAVA -VERSION. Assuming newest version is being used."
18
19arguments = "-settings=%HOME%\.jedit -server=%HOME%\.jedit\server"
20jedit_dir = GetExecPath()
21
22if (iMajor = 1 & iMid <= 1) then
23    'java -classpath %classpath%;'jedit_dir'\jedit.jar org.gjt.sp.jedit.jEdit 'arguments
24  else
25    'java -jar 'jedit_dir'\jedit.jar 'arguments
26
27return 0
28
29
30
31
32
33 /*
34  * Java version detector.
35  * Assumes java -version return quoted ("") version number.
36  * Written by os2bird on #netlabs
37  *
38  * Returns -1 on no java or failed to execute
39  *         -2 on invalid java version string.
40  *         version number.
41  */
42QueryJavaVersion: procedure expose iMajor iMid iMinor
43cQueued =  queued();
44'@echo off'
45'java -version 2>&1 | rxqueue /LIFO'
46i = queued();
47do while i > cQueued
48    pull sStr
49    if (pos("JAVA VERSION ", sStr) > 0) | (pos("JAVA.EXE VERSION ", sStr) > 0) then
50    do
51        do while(queued() > 0) 
52          pull sStrIngore; /* flush input stream */
53        end
54        parse var sStr sStuff '"'iMajor'.'iMid'.'iMinor'"'
55        if (iMinor <> '') then
56            return iMajor*100 + iMid * 10 + iMinor;
57         else
58             return -2
59     end
60     i = i - 1;
61 end
62 return -1;
63
64
65/*
66 * Returns the path of the script being executed.
67 */
68GetExecPath: procedure
69parse source result
70parse var result 'OS/2 ' dummy result                        /* Get full path of script */
71result=filespec("drive", result) || filespec("path", result) /* strip away filename */
72result=substr(result, 1, length(result)-1)                   /* remove backslash */
73return result