-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathcl-jupyter.lisp
51 lines (42 loc) · 1.88 KB
/
cl-jupyter.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;; not yet installed in quicklisp directory
(push (truename (format nil "~Asrc/" (directory-namestring *load-truename*)))
asdf:*central-registry*)
(let ((cmd-args
;; Borrowed from apply-argv, command-line-arguments. Temporary solution (?)
;; This is not PvE's code.
#+sbcl (cdr sb-ext:*posix-argv*) ; remove the program argument
#+clozure CCL:*UNPROCESSED-COMMAND-LINE-ARGUMENTS* ;(ccl::command-line-arguments)
#+gcl si:*command-args*
#+ecl (loop for i from 0 below (si:argc) collect (si:argv i))
#+cmu extensions:*command-line-strings*
#+allegro (sys:command-line-arguments)
#+lispworks sys:*line-arguments-list*
#+clisp ext:*args*
#-(or sbcl clozure gcl ecl cmu allegro lispworks clisp)
(error "get-argv not supported for your implementation")))
(when (= (length cmd-args) 0)
(progn
(format t "... initialization mode... please wait...~%")
(ql:quickload "cl-jupyter")
(format t "... initialization done...~%")
#+sbcl (sb-ext:exit :code 0)
#+(or openmcl mcl) (ccl::quit)
#-(or sbcl openmcl mcl)
(error 'not-implemented :proc (list 'quit code))))
(when (not (>= (length cmd-args) 3))
(error "Wrong number of arguments (given ~A, expecting at least 3)" (length cmd-args)))
(let ((def-dir (truename (car (last cmd-args 3)))))
;;(run-dir (truename (cadr cmd-args))))
;; add the source directory to the ASDF registry
;; (format t "Definition dir = ~A~%" def-dir)
(push def-dir asdf:*central-registry*)))
;; for debugging only:
;; (push (truename "./src/") asdf:*central-registry*)
;; activate debugging
(declaim (optimize (speed 0) (space 0) (debug 3) (safety 3)))
;; in production (?)
;;(declaim (optimize (speed 3) (space 0) (debug 0) (safety 2)))
(ql:quickload "cl-jupyter")
(in-package #:cl-jupyter-user)
;; start main loop
(cl-jupyter:kernel-start)