Saving a Shen program into a disk file

52 views
Skip to first unread message

Antti Ylikoski

unread,
Apr 10, 2017, 7:54:52 AM4/10/17
to Shen

This is a relatively simple question to the group, but:

I have been attempting to use the SBCL sb-ext:save-lisp-and-die
function.  The following LISP function is what I wrote, to attempt to
download a SBCL Shen program from the virtual memory into a binary
disk file:

______________________________

;;; AJY 2017-04-10

(defun save-shen (pathname)
  (sb-ext:save-lisp-and-die :executable t
   :core-file-name pathname))

______________________________

but I cannot make it work.  Any shrewd help would be very much
appreciated.  What is the file type required?  .FASL did not work.

yours, AJY
Helsinki, Finland, the EU


Bruno Deferrari

unread,
Apr 10, 2017, 8:24:30 AM4/10/17
to qil...@googlegroups.com
A few questions:

Is the code you pasted shen or lisp? In shen it is not going to be read as you expect because of the ":"s, you have to save it to a .lsp file and do `(lisp.load "yourfile.lsp")

Note that you will have to uppercase most of your symbols, it will look somewhat like this:

(DEFUN save-shen (Pathname)
  (SB-EXT:SAVE-LISP-AND-DIE
   Pathname
   :EXECUTABLE T
   :TOPLEVEL 'SHEN-TOPLEVEL))

the :TOPLEVEL parameter is the function that will be executed once you run the binary. Note that SHEN-TOPLEVEL is something from the version of the SBCL port on Github that was made for Shen20, your version will not have that function.

faust ~/p/s/shen-sbcl git:master✓ > ./Shen.exe 

Shen, copyright (C) 2010-2015 Mark Tarver
running under Common Lisp, implementation: SBCL
port 2.0 ported by Mark Tarver


(0-) (lisp.load "saver.lsp")
T

(1-) (save-shen "saved.exe")
[undoing binding stack and other enclosing state... done]
[defragmenting immobile space... 647+16146+28641+18825 objects... done]
[saving current Lisp image into saved.exe:
writing 4816 bytes from the read-only space at 0x20000000
writing 3216 bytes from the static space at 0x20100000
writing 2109440 bytes from the immobile space at 0x20300000
writing 12985632 bytes from the immobile space at 0x21b00000
writing 34635776 bytes from the dynamic space at 0x1000000000
done]
faust ~/p/s/shen-sbcl git:master✓ > ./saved.exe 

Shen, copyright (C) 2010-2015 Mark Tarver
running under Common Lisp, implementation: SBCL
port 2.0 ported by Mark Tarver


(2-) ^C
Quit.


--
You received this message because you are subscribed to the Google Groups "Shen" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qilang+unsubscribe@googlegroups.com.
To post to this group, send email to qil...@googlegroups.com.
Visit this group at https://groups.google.com/group/qilang.
For more options, visit https://groups.google.com/d/optout.



--
BD

Antti Ylikoski

unread,
Apr 10, 2017, 11:37:17 AM4/10/17
to Shen

Thank you indeed very much: You solved my problem.

The below mentioned will work in my OS Shen 19.1:

__________________________________________________

;;; AJY 2017-04-10
;;;
;;; Usage:
;;;
;;; Start Shen
;;; With Shen:
;;;
;;; (lisp.load "save-shen.lisp")
;;; (save-shen "myprog.exe")
;;;
;;; Then:
;;; In the Linux:
;;; $ ./myprog.exe
;;;


(DEFUN save-shen (Pathname)
  (SB-EXT:SAVE-LISP-AND-DIE
   Pathname
   :EXECUTABLE T))

__________________________________________________

Thanks, Antti J Ylikoski
Helsinki, Finland, the EU
To unsubscribe from this group and stop receiving emails from it, send an email to qilang+un...@googlegroups.com.

To post to this group, send email to qil...@googlegroups.com.
Visit this group at https://groups.google.com/group/qilang.
For more options, visit https://groups.google.com/d/optout.



--
BD
Reply all
Reply to author
Forward
0 new messages