diff --git a/src/main/java/com/en_circle/slt/plugin/SltLibrary.java b/src/main/java/com/en_circle/slt/plugin/SltLibrary.java index b0f6725..c48914e 100644 --- a/src/main/java/com/en_circle/slt/plugin/SltLibrary.java +++ b/src/main/java/com/en_circle/slt/plugin/SltLibrary.java @@ -14,7 +14,13 @@ public class SltLibrary { private static boolean loaded = false; - public static synchronized File getLibraryInitFile() throws IOException { + public static File getLibraryInitFile() throws IOException { + File sltPath = getSltPath(); + + return new File(sltPath, "load.lisp"); + } + + public static synchronized File getSltPath() throws IOException { File pluginPath = PluginPath.getPluginFolder(); File sltPath = new File(pluginPath, "slt"); if (!sltPath.exists()) { @@ -28,11 +34,10 @@ public static synchronized File getLibraryInitFile() throws IOException { if (!loaded) { extractAndCopy(sltPath); } - - return new File(sltPath, "load.lisp"); + return sltPath; } - private static void extractAndCopy(File sltPath) throws IOException { + private static synchronized void extractAndCopy(File sltPath) throws IOException { InputStream is = SltLibrary.class.getResourceAsStream("/slt.zip"); assert is != null; diff --git a/src/main/java/com/en_circle/slt/plugin/environment/SltABCLEnvironment.java b/src/main/java/com/en_circle/slt/plugin/environment/SltABCLEnvironment.java index 875a0f7..44ee429 100644 --- a/src/main/java/com/en_circle/slt/plugin/environment/SltABCLEnvironment.java +++ b/src/main/java/com/en_circle/slt/plugin/environment/SltABCLEnvironment.java @@ -53,7 +53,9 @@ protected Object prepareProcessEnvironment(SltLispEnvironmentProcessConfiguratio e.serverStartSetup = new File(tempDir, "startServer.cl"); e.serverStartSetup.deleteOnExit(); String sltCorePath = e.sltCore.getAbsolutePath(); - String startScriptTemplate = new ABCLInitScriptTemplate(c, sltCorePath, e.port).render(); + String swankPath = new File(new File(SltLibrary.getSltPath(), "libs"), "swank").getAbsolutePath(); + String eclectorPath = new File(new File(SltLibrary.getSltPath(), "libs"), "eclector").getAbsolutePath(); + String startScriptTemplate = new ABCLInitScriptTemplate(c, sltCorePath, swankPath, eclectorPath, e.port).render(); FileUtils.write(e.serverStartSetup, startScriptTemplate, StandardCharsets.UTF_8); tempDir.deleteOnExit(); @@ -144,7 +146,8 @@ public String getPid() { private static class ABCLInitScriptTemplate extends Template { - public ABCLInitScriptTemplate(SltABCLEnvironmentConfiguration configuration, String sltCoreScript, int port) { + public ABCLInitScriptTemplate(SltABCLEnvironmentConfiguration configuration, String sltCoreScript, + String swankPath, String eclectorPath, int port) { String quicklispPath = configuration.getQuicklispStartScript(); if (quicklispPath.contains("\\")) { quicklispPath = StringUtils.replace(quicklispPath, "\\", "\\\\"); @@ -156,10 +159,18 @@ public ABCLInitScriptTemplate(SltABCLEnvironmentConfiguration configuration, Str if (sltCoreScript.contains("\\")) { sltCoreScript = StringUtils.replace(sltCoreScript, "\\", "\\\\"); } + if (swankPath.contains("\\")) { + swankPath = StringUtils.replace(swankPath, "\\", "\\\\"); + } + if (eclectorPath.contains("\\")) { + eclectorPath = StringUtils.replace(eclectorPath, "\\", "\\\\"); + } add("qlpath", quicklispPath); add("port", "" + port); add("cwd", cwd); add("corefile", sltCoreScript); + add("swankPath", swankPath); + add("eclectorPath", eclectorPath); add("interpret", LispInterpret.ABCL.symbolName); } diff --git a/src/main/java/com/en_circle/slt/plugin/environment/SltAllegroCLEnvironment.java b/src/main/java/com/en_circle/slt/plugin/environment/SltAllegroCLEnvironment.java index c39ba99..ef888d7 100644 --- a/src/main/java/com/en_circle/slt/plugin/environment/SltAllegroCLEnvironment.java +++ b/src/main/java/com/en_circle/slt/plugin/environment/SltAllegroCLEnvironment.java @@ -54,7 +54,9 @@ protected Object prepareProcessEnvironment(SltLispEnvironmentProcessConfiguratio e.serverStartSetup = new File(tempDir, "startServer.cl"); e.serverStartSetup.deleteOnExit(); String sltCorePath = e.sltCore.getAbsolutePath(); - String startScriptTemplate = new AllegroCLInitScriptTemplate(c, sltCorePath, e.port).render(); + String swankPath = new File(new File(SltLibrary.getSltPath(), "libs"), "swank").getAbsolutePath(); + String eclectorPath = new File(new File(SltLibrary.getSltPath(), "libs"), "eclector").getAbsolutePath(); + String startScriptTemplate = new AllegroCLInitScriptTemplate(c, sltCorePath, swankPath, eclectorPath, e.port).render(); FileUtils.write(e.serverStartSetup, startScriptTemplate, StandardCharsets.UTF_8); tempDir.deleteOnExit(); @@ -144,7 +146,8 @@ private static class AllegroCLEnvironment { private static class AllegroCLInitScriptTemplate extends Template { - public AllegroCLInitScriptTemplate(SltAllegroCLEnvironmentConfiguration configuration, String sltCoreScript, int port) { + public AllegroCLInitScriptTemplate(SltAllegroCLEnvironmentConfiguration configuration, String sltCoreScript, + String swankPath, String eclectorPath, int port) { String quicklispPath = configuration.getQuicklispStartScript(); if (quicklispPath.contains("\\")) { quicklispPath = StringUtils.replace(quicklispPath, "\\", "\\\\"); @@ -156,10 +159,18 @@ public AllegroCLInitScriptTemplate(SltAllegroCLEnvironmentConfiguration configur if (sltCoreScript.contains("\\")) { sltCoreScript = StringUtils.replace(sltCoreScript, "\\", "\\\\"); } + if (swankPath.contains("\\")) { + swankPath = StringUtils.replace(swankPath, "\\", "\\\\"); + } + if (eclectorPath.contains("\\")) { + eclectorPath = StringUtils.replace(eclectorPath, "\\", "\\\\"); + } add("qlpath", quicklispPath); add("port", "" + port); add("cwd", cwd); add("corefile", sltCoreScript); + add("swankPath", swankPath); + add("eclectorPath", eclectorPath); add("interpret", LispInterpret.ALLEGRO.symbolName); } diff --git a/src/main/java/com/en_circle/slt/plugin/environment/SltCCLEnvironment.java b/src/main/java/com/en_circle/slt/plugin/environment/SltCCLEnvironment.java index b933177..8a1dd5e 100644 --- a/src/main/java/com/en_circle/slt/plugin/environment/SltCCLEnvironment.java +++ b/src/main/java/com/en_circle/slt/plugin/environment/SltCCLEnvironment.java @@ -54,7 +54,9 @@ protected Object prepareProcessEnvironment(SltLispEnvironmentProcessConfiguratio e.serverStartSetup = new File(tempDir, "startServer.cl"); e.serverStartSetup.deleteOnExit(); String sltCorePath = e.sltCore.getAbsolutePath(); - String startScriptTemplate = new CCLInitScriptTemplate(c, sltCorePath, e.port).render(); + String swankPath = new File(new File(SltLibrary.getSltPath(), "libs"), "swank").getAbsolutePath(); + String eclectorPath = new File(new File(SltLibrary.getSltPath(), "libs"), "eclector").getAbsolutePath(); + String startScriptTemplate = new CCLInitScriptTemplate(c, sltCorePath, swankPath, eclectorPath, e.port).render(); FileUtils.write(e.serverStartSetup, startScriptTemplate, StandardCharsets.UTF_8); tempDir.deleteOnExit(); @@ -144,7 +146,8 @@ private static class CCLEnvironment { private static class CCLInitScriptTemplate extends Template { - public CCLInitScriptTemplate(SltCCLEnvironmentConfiguration configuration, String sltCoreScript, int port) { + public CCLInitScriptTemplate(SltCCLEnvironmentConfiguration configuration, String sltCoreScript, + String swankPath, String eclectorPath, int port) { String quicklispPath = configuration.getQuicklispStartScript(); if (quicklispPath.contains("\\")) { quicklispPath = StringUtils.replace(quicklispPath, "\\", "\\\\"); @@ -156,10 +159,18 @@ public CCLInitScriptTemplate(SltCCLEnvironmentConfiguration configuration, Strin if (sltCoreScript.contains("\\")) { sltCoreScript = StringUtils.replace(sltCoreScript, "\\", "\\\\"); } + if (swankPath.contains("\\")) { + swankPath = StringUtils.replace(swankPath, "\\", "\\\\"); + } + if (eclectorPath.contains("\\")) { + eclectorPath = StringUtils.replace(eclectorPath, "\\", "\\\\"); + } add("qlpath", quicklispPath); add("port", "" + port); add("cwd", cwd); add("corefile", sltCoreScript); + add("swankPath", swankPath); + add("eclectorPath", eclectorPath); add("interpret", LispInterpret.CCL.symbolName); } diff --git a/src/main/java/com/en_circle/slt/plugin/environment/SltCMUCLEnvironment.java b/src/main/java/com/en_circle/slt/plugin/environment/SltCMUCLEnvironment.java index 20ece2c..b9597c9 100644 --- a/src/main/java/com/en_circle/slt/plugin/environment/SltCMUCLEnvironment.java +++ b/src/main/java/com/en_circle/slt/plugin/environment/SltCMUCLEnvironment.java @@ -54,7 +54,9 @@ protected Object prepareProcessEnvironment(SltLispEnvironmentProcessConfiguratio e.serverStartSetup = new File(tempDir, "startServer.cl"); e.serverStartSetup.deleteOnExit(); String sltCorePath = e.sltCore.getAbsolutePath(); - String startScriptTemplate = new CMUCLInitScriptTemplate(c, sltCorePath, e.port).render(); + String swankPath = new File(new File(SltLibrary.getSltPath(), "libs"), "swank").getAbsolutePath(); + String eclectorPath = new File(new File(SltLibrary.getSltPath(), "libs"), "eclector").getAbsolutePath(); + String startScriptTemplate = new CMUCLInitScriptTemplate(c, sltCorePath, swankPath, eclectorPath, e.port).render(); FileUtils.write(e.serverStartSetup, startScriptTemplate, StandardCharsets.UTF_8); tempDir.deleteOnExit(); @@ -144,7 +146,8 @@ private static class CMUCLEnvironment { private static class CMUCLInitScriptTemplate extends Template { - public CMUCLInitScriptTemplate(SltCMUCLEnvironmentConfiguration configuration, String sltCoreScript, int port) { + public CMUCLInitScriptTemplate(SltCMUCLEnvironmentConfiguration configuration, String sltCoreScript, + String swankPath, String eclectorPath, int port) { String quicklispPath = configuration.getQuicklispStartScript(); if (quicklispPath.contains("\\")) { quicklispPath = StringUtils.replace(quicklispPath, "\\", "\\\\"); @@ -156,10 +159,18 @@ public CMUCLInitScriptTemplate(SltCMUCLEnvironmentConfiguration configuration, S if (sltCoreScript.contains("\\")) { sltCoreScript = StringUtils.replace(sltCoreScript, "\\", "\\\\"); } + if (swankPath.contains("\\")) { + swankPath = StringUtils.replace(swankPath, "\\", "\\\\"); + } + if (eclectorPath.contains("\\")) { + eclectorPath = StringUtils.replace(eclectorPath, "\\", "\\\\"); + } add("qlpath", quicklispPath); add("port", "" + port); add("cwd", cwd); add("corefile", sltCoreScript); + add("swankPath", swankPath); + add("eclectorPath", eclectorPath); add("interpret", LispInterpret.CMUCL.symbolName); } diff --git a/src/main/java/com/en_circle/slt/plugin/environment/SltSBCLEnvironment.java b/src/main/java/com/en_circle/slt/plugin/environment/SltSBCLEnvironment.java index d557913..fefb439 100644 --- a/src/main/java/com/en_circle/slt/plugin/environment/SltSBCLEnvironment.java +++ b/src/main/java/com/en_circle/slt/plugin/environment/SltSBCLEnvironment.java @@ -54,7 +54,9 @@ protected Object prepareProcessEnvironment(SltLispEnvironmentProcessConfiguratio e.serverStartSetup = new File(tempDir, "startServer.cl"); e.serverStartSetup.deleteOnExit(); String sltCorePath = e.sltCore.getAbsolutePath(); - String startScriptTemplate = new SBCLInitScriptTemplate(c, sltCorePath, e.port).render(); + String swankPath = new File(new File(SltLibrary.getSltPath(), "libs"), "swank").getAbsolutePath(); + String eclectorPath = new File(new File(SltLibrary.getSltPath(), "libs"), "eclector").getAbsolutePath(); + String startScriptTemplate = new SBCLInitScriptTemplate(c, sltCorePath, swankPath, eclectorPath, e.port).render(); FileUtils.write(e.serverStartSetup, startScriptTemplate, StandardCharsets.UTF_8); tempDir.deleteOnExit(); @@ -143,7 +145,8 @@ private static class SBCLEnvironment { private static class SBCLInitScriptTemplate extends Template { - public SBCLInitScriptTemplate(SltSBCLEnvironmentConfiguration configuration, String sltCoreScript, int port) { + public SBCLInitScriptTemplate(SltSBCLEnvironmentConfiguration configuration, String sltCoreScript, + String swankPath, String eclectorPath, int port) { String quicklispPath = configuration.getQuicklispStartScript(); if (quicklispPath.contains("\\")) { quicklispPath = StringUtils.replace(quicklispPath, "\\", "\\\\"); @@ -155,10 +158,18 @@ public SBCLInitScriptTemplate(SltSBCLEnvironmentConfiguration configuration, Str if (sltCoreScript.contains("\\")) { sltCoreScript = StringUtils.replace(sltCoreScript, "\\", "\\\\"); } + if (swankPath.contains("\\")) { + swankPath = StringUtils.replace(swankPath, "\\", "\\\\"); + } + if (eclectorPath.contains("\\")) { + eclectorPath = StringUtils.replace(eclectorPath, "\\", "\\\\"); + } add("qlpath", quicklispPath); add("port", "" + port); add("cwd", cwd); add("corefile", sltCoreScript); + add("swankPath", swankPath); + add("eclectorPath", eclectorPath); add("interpret", LispInterpret.SBCL.symbolName); } diff --git a/src/main/java/com/en_circle/slt/plugin/lisp/lisp/components/LispArguments.java b/src/main/java/com/en_circle/slt/plugin/lisp/lisp/components/LispArgument.java similarity index 65% rename from src/main/java/com/en_circle/slt/plugin/lisp/lisp/components/LispArguments.java rename to src/main/java/com/en_circle/slt/plugin/lisp/lisp/components/LispArgument.java index 3a3d9f4..61ff3b8 100644 --- a/src/main/java/com/en_circle/slt/plugin/lisp/lisp/components/LispArguments.java +++ b/src/main/java/com/en_circle/slt/plugin/lisp/lisp/components/LispArgument.java @@ -1,7 +1,5 @@ package com.en_circle.slt.plugin.lisp.lisp.components; -public class LispArguments { - - +public class LispArgument { } diff --git a/src/main/java/com/en_circle/slt/plugin/lisp/lisp/components/LispLambdaSignature.java b/src/main/java/com/en_circle/slt/plugin/lisp/lisp/components/LispLambdaSignature.java new file mode 100644 index 0000000..561a6cf --- /dev/null +++ b/src/main/java/com/en_circle/slt/plugin/lisp/lisp/components/LispLambdaSignature.java @@ -0,0 +1,19 @@ +package com.en_circle.slt.plugin.lisp.lisp.components; + +import com.en_circle.slt.plugin.lisp.psi.LispList; + +public class LispLambdaSignature { + + public LispLambdaSignature(LispList list, boolean isMethod) { + parseSignature(list, isMethod); + } + + public LispLambdaSignature() { + // NIL signature + } + + private void parseSignature(LispList list, boolean isMethod) { + + } + +} diff --git a/src/main/lisp/libs/eclector/eclector.asd b/src/main/lisp/libs/eclector/eclector.asd index 6f79962..8c91910 100644 --- a/src/main/lisp/libs/eclector/eclector.asd +++ b/src/main/lisp/libs/eclector/eclector.asd @@ -1,3 +1,5 @@ +(format T "Loading eclector from slt override~%") + (defsystem "eclector" :description "A portable, extensible Common Lisp reader." :license "BSD" diff --git a/src/main/lisp/libs/swank/swank-loader.lisp b/src/main/lisp/libs/swank/swank-loader.lisp index 44ae5d6..c9bb5de 100644 --- a/src/main/lisp/libs/swank/swank-loader.lisp +++ b/src/main/lisp/libs/swank/swank-loader.lisp @@ -16,6 +16,8 @@ ;; (load ".../swank-loader.lisp") ;; (setq swank-loader::*fasl-directory* "/tmp/fasl/") ;; (swank-loader:init) +(format T "Loading swank from slt override~%") + (require "asdf") (cl:defpackage :swank-loader diff --git a/src/main/lisp/libs/swank/swank.asd b/src/main/lisp/libs/swank/swank.asd index 7ab3521..33e14ff 100644 --- a/src/main/lisp/libs/swank/swank.asd +++ b/src/main/lisp/libs/swank/swank.asd @@ -1,6 +1,4 @@ -(format T "OVERRIDE~%") - - ;;; -*- lisp -*- +;;; -*- lisp -*- ;; ASDF system definition for loading the Swank server independently ;; of Emacs. diff --git a/src/main/lisp/libs/swank/swank.lisp b/src/main/lisp/libs/swank/swank.lisp index 8ad37d3..a5032d5 100644 --- a/src/main/lisp/libs/swank/swank.lisp +++ b/src/main/lisp/libs/swank/swank.lisp @@ -25,8 +25,6 @@ (defvar *swank-debug-p* t "When true, print extra debugging information.") -(defvar *xxxx* 10) - (defvar *backtrace-pprint-dispatch-table* (let ((table (copy-pprint-dispatch nil))) (flet ((print-string (stream string) diff --git a/src/main/lisp/swank/swank.lisp b/src/main/lisp/swank/swank.lisp index 3c96747..49b3b88 100644 --- a/src/main/lisp/swank/swank.lisp +++ b/src/main/lisp/swank/swank.lisp @@ -2,8 +2,7 @@ (when (eq slt:+slt-interpret+ :sbcl) (load (merge-pathnames "swank-sbcl.lisp" *load-truename*)) - (in-package swank/source-file-cache) - (setf *source-snippet-size* 0)) + (setf swank/source-file-cache::*source-snippet-size* 0)) (when (eq slt:+slt-interpret+ :abcl) (load (merge-pathnames "swank-abcl.lisp" *load-truename*))) (when (eq slt:+slt-interpret+ :ccl) @@ -12,8 +11,7 @@ (load (merge-pathnames "swank-allegro.lisp" *load-truename*))) (when (eq slt:+slt-interpret+ :cmucl) (load (merge-pathnames "swank-cmucl.lisp" *load-truename*)) - (in-package swank/source-file-cache) - (setf *source-snippet-size* 0)) + (setf swank/source-file-cache::*source-snippet-size* 0)) (in-package :swank) diff --git a/src/main/resources/templates/en_US/initscript.allegro.cl b/src/main/resources/templates/en_US/initscript.allegro.cl index 294a3bd..3b12e29 100644 --- a/src/main/resources/templates/en_US/initscript.allegro.cl +++ b/src/main/resources/templates/en_US/initscript.allegro.cl @@ -7,9 +7,17 @@ "Defines current slt interpret.") (load "~qlpath~") + (ql:quickload :cl-utilities) -(ql:quickload :swank) -(ql:quickload :eclector) + +(load "~swankPath~/swank-loader.lisp") +(setq swank-loader::*source-directory* "~swankPath~/") +(setq swank-loader::*fasl-directory* "~swankPath~/../fasl/") +(swank-loader:init) + +(let ((ql:*local-project-directories* + (append (list #P"~eclectorPath~") ql:*local-project-directories*))) + (ql:quickload :eclector)) ; Does not work in allegro... ; (setf *default-pathname-defaults* #P"~cwd~") diff --git a/src/main/resources/templates/en_US/initscript.cl b/src/main/resources/templates/en_US/initscript.cl index 846bf5d..0a38b3f 100644 --- a/src/main/resources/templates/en_US/initscript.cl +++ b/src/main/resources/templates/en_US/initscript.cl @@ -7,9 +7,17 @@ "Defines current slt interpret.") (load "~qlpath~") + (ql:quickload :cl-utilities) -(ql:quickload :swank) -(ql:quickload :eclector) + +(load "~swankPath~/swank-loader.lisp") +(setq swank-loader::*source-directory* "~swankPath~/") +(setq swank-loader::*fasl-directory* "~swankPath~/../fasl/") +(swank-loader:init) + +(let ((ql:*local-project-directories* + (append (list #P"~eclectorPath~") ql:*local-project-directories*))) + (ql:quickload :eclector)) (setf *default-pathname-defaults* #P"~cwd~")