mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2025-12-06 02:40:26 -08:00
android/example: simplify the example
This is just a "Hello world" example. Simplify it and improve the readme. More feature full application may be found at: https://gitlab.common-lisp.net/ecl/ecl-android
This commit is contained in:
parent
4ee8e62135
commit
fd7547aaa6
3 changed files with 27 additions and 86 deletions
|
|
@ -1,14 +1,21 @@
|
|||
This project is a base project for ECL Android.
|
||||
It is created by Sylvain Ageneau <ageneau@gmail.com>.
|
||||
Original location of this project is:
|
||||
This example was originally developed by Sylvain Ageneau. Integration
|
||||
with the current ECL done by Evrim Ulu and Daniel Kochmański.
|
||||
|
||||
Original location of this this example is:
|
||||
http://github.com/ageneau/ecl-android
|
||||
|
||||
Instructions:
|
||||
$ android update project -t android-19 -p .
|
||||
$ ln -s {$ECL_ANDROID_DIR} ecl-android
|
||||
$ ln -s ${ECL_ANDROID_DIR}/lib/${ECL_LIB_DIR} ecl-libdir
|
||||
$ android update project -t android-10 -p .
|
||||
$ ndk-build
|
||||
$ ant debug install
|
||||
|
||||
Please direct further questions to ecl-devel@common-lisp.net
|
||||
Where ECL_ANDROID_DIR contains a prefix to the directory where you
|
||||
installed cross-compiled ECL and the ECL_LIB_DIR contains name of the
|
||||
directory which ECL created for it's internal files. Example:
|
||||
|
||||
evrim ulu <evrimulu@gmail.com>
|
||||
March 2015.
|
||||
$ export ECL_ANDROID_DIR=/home/lisps/ecl-android-arm32
|
||||
$ export ECL_LIB_DIR=ecl-16.1.0
|
||||
|
||||
Please direct further questions to ecl-devel@common-lisp.net
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@
|
|||
(lisp-implementation-version)
|
||||
(ext:lisp-implementation-vcs-id))
|
||||
|
||||
(format t "Setting environment variables~%")
|
||||
(setq *default-directory*
|
||||
*default-pathname-defaults*)
|
||||
(defvar *ecl-home* *default-directory*)
|
||||
(defvar *ecl-home* *default-pathname-defaults*)
|
||||
|
||||
(format t "Loading the modules~%")
|
||||
(require '#:asdf)
|
||||
|
|
@ -17,72 +14,6 @@
|
|||
|
||||
(pushnew (namestring *default-pathname-defaults*)
|
||||
asdf:*central-registry*)
|
||||
(pushnew (namestring (merge-pathnames #P"home/slime-2.14/" *ecl-home*))
|
||||
asdf:*central-registry*)
|
||||
|
||||
(format t "Preparing swank~%")
|
||||
(handler-case (asdf:oos 'asdf:load-op :swank :verbose t)
|
||||
(condition (c)
|
||||
(format t "condition ~A happened~%" c)
|
||||
(format t "filepath SYS:SLIME-2.14;SWANK.ASD.NEWEST: ~A~%"
|
||||
(truename #P"SYS:SLIME-2.14;SWANK.ASD.NEWEST"))
|
||||
(force-output)
|
||||
(error c)))
|
||||
(swank-loader:init :load-contribs t
|
||||
:setup t
|
||||
:delete t
|
||||
:quiet nil)
|
||||
|
||||
;; The following "patches" swank to work correctly on android/iOS
|
||||
(in-package :swank/backend)
|
||||
(defimplementation lisp-implementation-program ()
|
||||
"Return the argv[0] of the running Lisp process, or NIL."
|
||||
;; "org.lisp.ecl"
|
||||
nil)
|
||||
|
||||
(in-package :swank)
|
||||
(defun repl-input-stream-read (connection stdin)
|
||||
(loop
|
||||
(let* ((socket (connection.socket-io connection))
|
||||
(inputs (list socket #+(or) stdin))
|
||||
(ready (wait-for-input inputs)))
|
||||
(cond ((eq ready :interrupt)
|
||||
(check-slime-interrupts))
|
||||
((member socket ready)
|
||||
;; A Slime request from Emacs is pending; make sure to
|
||||
;; redirect IO to the REPL buffer.
|
||||
(with-simple-restart (process-input "Continue reading input.")
|
||||
(let ((*sldb-quit-restart* (find-restart 'process-input)))
|
||||
(with-io-redirection (connection)
|
||||
(handle-requests connection t)))))
|
||||
((member stdin ready)
|
||||
;; User typed something into the *inferior-lisp* buffer,
|
||||
;; so do not redirect.
|
||||
(return (read-non-blocking stdin)))
|
||||
(t (assert (null ready)))))))
|
||||
|
||||
;; (format t "Loading user.lisp~%")
|
||||
;; (handler-case (cond ((probe-file #P"user.lisp")
|
||||
;; (format t "user exists~%")
|
||||
;; (load "user"))
|
||||
;; (T (format t "user.lisp doesn't exist~%")))
|
||||
;; (condition (c)
|
||||
;; (format t "condition ~A happened~%" c)
|
||||
;; (error c)))
|
||||
|
||||
(when (probe-file #P"etc/user.lisp")
|
||||
(load "etc/user"))
|
||||
|
||||
(format t "Starting swank~%")
|
||||
(mp:process-run-function
|
||||
"SLIME-listener"
|
||||
(lambda ()
|
||||
(let ((swank::*loopback-interface* "0.0.0.0"))
|
||||
(swank:create-server :port 4005
|
||||
:dont-close t
|
||||
;; :style nil #|:spawn|#
|
||||
))))
|
||||
|
||||
(format t "Initialization done~%")
|
||||
(force-output)
|
||||
(sleep 3)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
(in-package :cl-user)
|
||||
|
||||
(setq *default-directory*
|
||||
*default-pathname-defaults*)
|
||||
|
||||
(defun sysinfo (&optional (out *standard-output*))
|
||||
"Print the current environment to a stream."
|
||||
(declare (stream out))
|
||||
|
|
@ -14,14 +11,14 @@ Implementation:~20t~a~%~7tversion:~20t~a~%Machine: type:~20t~a
|
|||
#+darwin (princ " Darwin")
|
||||
#+unix (princ " Unix")
|
||||
(format out "~%Software: type:~20t~a~%~7tversion:~20t~a~%Site:~20t~a (~a)
|
||||
User home:~20t~a~%Current directory:~20t~a~%Default pathname:~20t~a~%"
|
||||
User home:~20t~a~%Default pathname:~20t~a~%"
|
||||
(software-type) (software-version) (long-site-name)
|
||||
(short-site-name) (user-homedir-pathname) *default-directory*
|
||||
(short-site-name) (user-homedir-pathname)
|
||||
*default-pathname-defaults*)
|
||||
(format out "Features: ~s.
|
||||
Modules:~s.~%
|
||||
Current package:~s~%"
|
||||
*features* *modules* *package*)
|
||||
*features* *modules* *package*)
|
||||
(flet ((exdi (fl) (integer-length (nth-value 1 (decode-float fl)))))
|
||||
(format out "Fixnum length:~25t~3d bits
|
||||
Short Floats:~25t~3d bits exponent, ~3d bits significand (mantissa)
|
||||
|
|
@ -48,7 +45,12 @@ Current time:~25t" (/ internal-time-units-per-second) *gensym-counter*)
|
|||
(format out "~a" (get-universal-time))
|
||||
(format out "~%~75~~%") (room) (values))
|
||||
|
||||
(defun sysinit ()
|
||||
(sysinfo)
|
||||
|
||||
|
||||
;; Quicklisp
|
||||
|
||||
(defun get-quicklisp ()
|
||||
(format t "Loading the quicklisp subsystem~%")
|
||||
(require '#:ecl-quicklisp)
|
||||
(require '#:deflate)
|
||||
|
|
@ -58,5 +60,6 @@ Current time:~25t" (/ internal-time-units-per-second) *gensym-counter*)
|
|||
(eval (read-from-string
|
||||
"(setf (symbol-function 'ql-gunzipper:gunzip) #'deflate:gunzip))")))
|
||||
|
||||
(sysinfo)
|
||||
;; (sysinit)
|
||||
#+(or)(get-quicklisp)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue