commit fcb63107aa0ad6cdff7489d80e2b6d5415042fe0 Author: Enrico Lumetti Date: Mon May 2 23:35:49 2022 +0200 Hello world diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..888ac01 --- /dev/null +++ b/LICENSE @@ -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. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..07b58a8 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Hello World in Common Lisp + +A simple test to compare different Common Lisps when building +a standalone hello world executable. diff --git a/build-exe-ccl.cl b/build-exe-ccl.cl new file mode 100644 index 0000000..a2097eb --- /dev/null +++ b/build-exe-ccl.cl @@ -0,0 +1,3 @@ +(load "hello.cl") +(save-application "hello-ccl" :toplevel-function #'main + :prepend-kernel t) diff --git a/build-exe-clisp.cl b/build-exe-clisp.cl new file mode 100644 index 0000000..f26cbf5 --- /dev/null +++ b/build-exe-clisp.cl @@ -0,0 +1,2 @@ +(load "hello-clisp.cl") +(ext:saveinitmem "hello-clisp" :quiet t :executable t :init-function #'main) diff --git a/build-exe-ecl.cl b/build-exe-ecl.cl new file mode 100644 index 0000000..d6328f9 --- /dev/null +++ b/build-exe-ecl.cl @@ -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")) diff --git a/build-exe-mkcl.cl b/build-exe-mkcl.cl new file mode 100644 index 0000000..e5b3ae1 --- /dev/null +++ b/build-exe-mkcl.cl @@ -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)) + diff --git a/build-image-ccl.cl b/build-image-ccl.cl new file mode 100644 index 0000000..3e14da2 --- /dev/null +++ b/build-image-ccl.cl @@ -0,0 +1,3 @@ +(load "hello.cl") +(save-application "hello-ccl.image" :toplevel-function #'main) + diff --git a/build-image-clisp.cl b/build-image-clisp.cl new file mode 100644 index 0000000..c95081f --- /dev/null +++ b/build-image-clisp.cl @@ -0,0 +1,2 @@ +(require "hello-clisp.cl") +(ext:saveinitmem "hello-clisp.image" :quiet t :init-function #'main) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..4b54909 --- /dev/null +++ b/build.sh @@ -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 diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..465a15c --- /dev/null +++ b/clean.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# + +rm hello hello-ccl hello-ccl.image hello-clisp hello-clisp.image hello-ecl hello-ecl.o diff --git a/hello-clisp.cl b/hello-clisp.cl new file mode 100644 index 0000000..b4bb5c3 --- /dev/null +++ b/hello-clisp.cl @@ -0,0 +1,3 @@ +(defun main () + (format t "hello, world!") + (ext:exit)) diff --git a/hello-ecl.cl b/hello-ecl.cl new file mode 100644 index 0000000..1ab9de4 --- /dev/null +++ b/hello-ecl.cl @@ -0,0 +1,5 @@ +(defun main () + (format t "hello, world!")) +(main) +(si:exit) + diff --git a/hello.c b/hello.c new file mode 100644 index 0000000..606aa46 --- /dev/null +++ b/hello.c @@ -0,0 +1,5 @@ +#include +int main() { + puts("Hello world!"); + return 0; +} diff --git a/hello.cl b/hello.cl new file mode 100644 index 0000000..c1de2a3 --- /dev/null +++ b/hello.cl @@ -0,0 +1,2 @@ +(defun main () + (format t "hello, world!"))