[snow-cvs] r16 - in trunk/src: java/snow lisp/snow

Alessio Stalla astalla at common-lisp.net
Wed Nov 18 06:28:25 UTC 2009


Author: astalla
Date: Wed Nov 18 01:28:24 2009
New Revision: 16

Log:
Fixed pathname concatenation that made Snow not load on Windows.


Modified:
   trunk/src/java/snow/Snow.java
   trunk/src/lisp/snow/snow.lisp

Modified: trunk/src/java/snow/Snow.java
==============================================================================
--- trunk/src/java/snow/Snow.java	(original)
+++ trunk/src/java/snow/Snow.java	Wed Nov 18 01:28:24 2009
@@ -54,14 +54,7 @@
     private static boolean init = false;
     private static ScriptEngine lispEngine;
     private static final String fileSeparator = System.getProperty("file.separator");
-    
-    private static final String fixDirPath(String path) {
-	if(!path.endsWith(fileSeparator)) {
-	    path += fileSeparator;
-	}
-	return path;
-    }
-    
+        
     /**
      * This method is public only because it needs to be called from Lisp.
      * Do not call it.
@@ -154,13 +147,36 @@
 		baseDir = fixDirPath(f.getParentFile().getParent());
 		libDir = baseDir; 
 	    }
-	    lispEngine.eval("(pushnew #P\"" + baseDir + "snow/\" asdf:*central-registry* :test #'equal)");
-	    lispEngine.eval("(pushnew #P\"" + baseDir + "snow/swing/\" asdf:*central-registry* :test #'equal)");
-	    lispEngine.eval("(pushnew #P\"" + libDir + "cl-utilities-1.2.4/\" asdf:*central-registry* :test #'equal)");
-	    lispEngine.eval("(pushnew #P\"" + libDir + "named-readtables/\" asdf:*central-registry* :test #'equal)");
-	    lispEngine.eval("(pushnew #P\"" + libDir + "cells/\" asdf:*central-registry* :test #'equal)");
-	    lispEngine.eval("(pushnew #P\"" + libDir + "cells/utils-kt/\" asdf:*central-registry* :test #'equal)");
+	    addToAsdfCentralRegistry(lispEngine, baseDir, "snow");
+	    addToAsdfCentralRegistry(lispEngine, baseDir, "snow", "swing");
+	    addToAsdfCentralRegistry(lispEngine, libDir, "cl-utilities-1.2.4");
+	    addToAsdfCentralRegistry(lispEngine, libDir, "named-readtables");
+	    addToAsdfCentralRegistry(lispEngine, libDir, "cells");
+	    addToAsdfCentralRegistry(lispEngine, libDir, "cells", "utils-kt");
+	}
+    }
+
+    private static Object addToAsdfCentralRegistry(ScriptEngine lispEngine, String base, String... path) throws ScriptException {
+	return lispEngine.eval("(pushnew #P\"" + makePath(base, path) + "\" asdf:*central-registry* :test #'equal)");
+    }
+    
+    private static String makePath(String base, String... path) {
+	for(String s : path) {
+	    base = fixDirPath(base) + s;
 	}
+	return escapePath(fixDirPath(base));
+    }
+
+    private static String escapePath(String str) {
+	//Replace single \ with double \ for Windows paths
+	return str.replace("\\", "\\\\"); 
+    }
+
+    private static final String fixDirPath(String path) {
+	if(!path.endsWith(fileSeparator)) {
+	    path += fileSeparator;
+	}
+	return path;
     }
 
     public static synchronized ScriptEngine init() throws ScriptException {
@@ -225,7 +241,7 @@
 	    if(args.length == 0) { //Launch GUI REPL
 		evalResource(Snow.class, "/snow/start.lisp", true);
 	    } else { //Launch regular ABCL
-		lispEngine.eval("(TOP-LEVEL::TOP-LEVEL)");
+		lispEngine.eval("(LET ((*PACKAGE* (FIND-PACKAGE :SNOW-USER))) (TOP-LEVEL::TOP-LEVEL-LOOP))");
 		//org.armedbear.lisp.Main.main(args);
 	    }
 	} catch (Exception e) {

Modified: trunk/src/lisp/snow/snow.lisp
==============================================================================
--- trunk/src/lisp/snow/snow.lisp	(original)
+++ trunk/src/lisp/snow/snow.lisp	Wed Nov 18 01:28:24 2009
@@ -250,6 +250,9 @@
 (define-container-widget dialog (parent title modal-p visible-p)
   make-dialog)
 
+;;Menus
+(definterface make-menu-bar *gui-backend* (&key &allow-other-keys))
+
 ;;Panels
 (definterface make-panel *gui-backend* (&key &allow-other-keys))
 




More information about the snow-cvs mailing list