Hello world

This commit is contained in:
Enrico Lumetti 2022-05-02 23:35:49 +02:00
commit fcb63107aa
14 changed files with 58 additions and 0 deletions

6
LICENSE Normal file
View File

@ -0,0 +1,6 @@
Copyright (C) 2022 by Enrico Lumetti
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

4
README.md Normal file
View File

@ -0,0 +1,4 @@
# Hello World in Common Lisp
A simple test to compare different Common Lisps when building
a standalone hello world executable.

3
build-exe-ccl.cl Normal file
View File

@ -0,0 +1,3 @@
(load "hello.cl")
(save-application "hello-ccl" :toplevel-function #'main
:prepend-kernel t)

2
build-exe-clisp.cl Normal file
View File

@ -0,0 +1,2 @@
(load "hello-clisp.cl")
(ext:saveinitmem "hello-clisp" :quiet t :executable t :init-function #'main)

4
build-exe-ecl.cl Normal file
View File

@ -0,0 +1,4 @@
(defconstant +standalone-exe+ (compile-file-pathname "standalone" :type :program))
(compile-file "hello-ecl.cl" :system-p t)
(c:build-program "hello-ecl" :lisp-files '("hello-ecl.o"))

7
build-exe-mkcl.cl Normal file
View File

@ -0,0 +1,7 @@
(c::build-program +standalone-exe+
:lisp-files
(list (compile-file-pathname "hello.cl" :type :object))
:ld-flags
:epilogue-code
'(si::quit))

3
build-image-ccl.cl Normal file
View File

@ -0,0 +1,3 @@
(load "hello.cl")
(save-application "hello-ccl.image" :toplevel-function #'main)

2
build-image-clisp.cl Normal file
View File

@ -0,0 +1,2 @@
(require "hello-clisp.cl")
(ext:saveinitmem "hello-clisp.image" :quiet t :init-function #'main)

8
build.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
lx86cl64 -l build-image-ccl.cl
lx86cl64 -l build-exe-ccl.cl
ecl --shell build-exe-ecl.cl
clisp build-exe-clisp.cl
clisp build-image-clisp.cl
cc -o hello hello.c

4
clean.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
#
rm hello hello-ccl hello-ccl.image hello-clisp hello-clisp.image hello-ecl hello-ecl.o

3
hello-clisp.cl Normal file
View File

@ -0,0 +1,3 @@
(defun main ()
(format t "hello, world!")
(ext:exit))

5
hello-ecl.cl Normal file
View File

@ -0,0 +1,5 @@
(defun main ()
(format t "hello, world!"))
(main)
(si:exit)

5
hello.c Normal file
View File

@ -0,0 +1,5 @@
#include <stdio.h>
int main() {
puts("Hello world!");
return 0;
}

2
hello.cl Normal file
View File

@ -0,0 +1,2 @@
(defun main ()
(format t "hello, world!"))