Skip to content

Commit

Permalink
#60
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Vanusanik committed Mar 2, 2023
1 parent 746ed47 commit d993ca6
Show file tree
Hide file tree
Showing 15 changed files with 121 additions and 30 deletions.
13 changes: 9 additions & 4 deletions src/main/java/com/en_circle/slt/plugin/SltLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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, "\\", "\\\\");
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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, "\\", "\\\\");
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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, "\\", "\\\\");
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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, "\\", "\\\\");
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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, "\\", "\\\\");
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.en_circle.slt.plugin.lisp.lisp.components;

public class LispArguments {


public class LispArgument {

}
Original file line number Diff line number Diff line change
@@ -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) {

}

}
2 changes: 2 additions & 0 deletions src/main/lisp/libs/eclector/eclector.asd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(format T "Loading eclector from slt override~%")

(defsystem "eclector"
:description "A portable, extensible Common Lisp reader."
:license "BSD"
Expand Down
2 changes: 2 additions & 0 deletions src/main/lisp/libs/swank/swank-loader.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/main/lisp/libs/swank/swank.asd
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
(format T "OVERRIDE~%")

;;; -*- lisp -*-
;;; -*- lisp -*-

;; ASDF system definition for loading the Swank server independently
;; of Emacs.
Expand Down
2 changes: 0 additions & 2 deletions src/main/lisp/libs/swank/swank.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions src/main/lisp/swank/swank.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
12 changes: 10 additions & 2 deletions src/main/resources/templates/en_US/initscript.allegro.cl
Original file line number Diff line number Diff line change
Expand Up @@ -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~")
Expand Down
12 changes: 10 additions & 2 deletions src/main/resources/templates/en_US/initscript.cl
Original file line number Diff line number Diff line change
Expand Up @@ -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~")

Expand Down

0 comments on commit d993ca6

Please sign in to comment.