PageRenderTime 37ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre4/jedit.cmd

#
Batch | 73 lines | 61 code | 12 blank | 0 comment | 7 complexity | c23e5250c60e98cd2825ba23f8089d8b MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. rc = QueryJavaVersion()
  9. if (rc = -1) then
  10. do
  11. say "java.exe cannot be found"
  12. return -1;
  13. end
  14. if (rc = -2) then
  15. say "Unexpected response to JAVA -VERSION. Assuming newest version is being used."
  16. arguments = "-settings=%HOME%\.jedit -server=%HOME%\.jedit\server"
  17. jedit_dir = GetExecPath()
  18. if (iMajor = 1 & iMid <= 1) then
  19. 'java -classpath %classpath%;'jedit_dir'\jedit.jar org.gjt.sp.jedit.jEdit 'arguments
  20. else
  21. 'java -jar 'jedit_dir'\jedit.jar 'arguments
  22. return 0
  23. /*
  24. * Java version detector.
  25. * Assumes java -version return quoted ("") version number.
  26. * Written by os2bird on #netlabs
  27. *
  28. * Returns -1 on no java or failed to execute
  29. * -2 on invalid java version string.
  30. * version number.
  31. */
  32. QueryJavaVersion: procedure expose iMajor iMid iMinor
  33. cQueued = queued();
  34. '@echo off'
  35. 'java -version 2>&1 | rxqueue /LIFO'
  36. i = queued();
  37. do while i > cQueued
  38. pull sStr
  39. if (pos("JAVA VERSION ", sStr) > 0) | (pos("JAVA.EXE VERSION ", sStr) > 0) then
  40. do
  41. do while(queued() > 0)
  42. pull sStrIngore; /* flush input stream */
  43. end
  44. parse var sStr sStuff '"'iMajor'.'iMid'.'iMinor'"'
  45. if (iMinor <> '') then
  46. return iMajor*100 + iMid * 10 + iMinor;
  47. else
  48. return -2
  49. end
  50. i = i - 1;
  51. end
  52. return -1;
  53. /*
  54. * Returns the path of the script being executed.
  55. */
  56. GetExecPath: procedure
  57. parse source result
  58. parse var result 'OS/2 ' dummy result /* Get full path of script */
  59. result=filespec("drive", result) || filespec("path", result) /* strip away filename */
  60. result=substr(result, 1, length(result)-1) /* remove backslash */
  61. return result