commit: e36122f81530a6e6f0e5aeb3f4136536e992c24e
parent 7e63f750d8063b34b573a2974effe23d68ee8a1e
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 22 Oct 2022 10:47:34 +0200
Add support for Chez Scheme bytecode
Diffstat:
6 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/.reuse/dep5 b/.reuse/dep5
@@ -3,6 +3,6 @@ Upstream-Name: deblob
Upstream-Contact: deblob Authors <https://hacktivis.me/projects/deblob>
Source: https://hacktivis.me/projects/deblob
-Files: test/fixtures/pyc/*.pyc test/fixtures/hello.luac* test/fixtures/hello.class test/fixtures/hello.nqp.moarvm test/fixtures/hello.pir.pbc test/fixtures/perl_storage.pst test/fixtures/hello.beam test/fixtures/empty.dtb
+Files: test/fixtures/pyc/*.pyc test/fixtures/hello.luac* test/fixtures/hello.class test/fixtures/hello.nqp.moarvm test/fixtures/hello.pir.pbc test/fixtures/perl_storage.pst test/fixtures/hello.beam test/fixtures/empty.dtb test/fixtures/hello-chez.so
Copyright: 2019-2022 deblob Authors <https://hacktivis.me/projects/deblob>
License: BSD-3-Clause
diff --git a/deblob.1 b/deblob.1
@@ -69,6 +69,8 @@ Perl Storable data (v0.6 and v0.7)
.It
Device Tree Blob, typically
.Sq *.dtb
+.It
+Chez Scheme bytecode
.El
.Sh EXAMPLES
The following code block shows how it can be used in Gentoo's
diff --git a/main.ha b/main.ha
@@ -37,7 +37,8 @@ const magic: [_][]u8 = [
// Parrot Bytecode https://github.com/parrot/parrot/blob/master/docs/parrotbyte.pod
[0xFE, 'P', 'B', 'C', '\r', '\n', 0x1A, '\n'],
['p', 'e', 'r', 'l', '-', 's', 't', 'o', 'r', 'e'], // Perl Storable(v0.6)
- ['p', 's', 't', '0'] // Perl Storable(v0.7)
+ ['p', 's', 't', '0'], // Perl Storable(v0.7)
+ [0x00, 0x00, 0x00, 0x00, 'c', 'h', 'e', 'z'], // Chez Scheme bytecode
];
const dos_magic: []u8 = ['M', 'Z'];
const pe_magic: []u8 = ['P', 'E', 0x00, 0x00];
@@ -203,7 +204,7 @@ fn check_dir(dirname: str) (void | errors::invalid) = {
case let e: fs::error =>
fmt::fatalf("os::readdir({}): {}", dirname, fs::strerror(e));
};
- assert(len(files_before) == 37);
+ assert(len(files_before) == 39);
const ret = check_dir(dirname);
assert(ret is void);
@@ -214,7 +215,7 @@ fn check_dir(dirname: str) (void | errors::invalid) = {
case let e: fs::error =>
fmt::fatalf("os::readdir({}): {}", dirname, fs::strerror(e));
};
- assert(len(files_after) == 22);
+ assert(len(files_after) == 23);
};
export fn main() void = {
diff --git a/test/fixtures/Makefile b/test/fixtures/Makefile
@@ -11,9 +11,10 @@ PARROT ?= parrot
PERL ?= perl
ERLC ?= erlc
DTC ?= dtc
+CHEZ ?= chezscheme
NONBUNDLED_BLOBS = hello hello.a hello.o
-TEST_BLOBS = $(NONBUNDLED_BLOBS) hello.exe hello.luac53 hello.luac54 hello.wasm hello.class hello.nqp.moarvm hello.pir.pbc perl_storage.pst hello.beam empty.dtb
+TEST_BLOBS = $(NONBUNDLED_BLOBS) hello.exe hello.luac53 hello.luac54 hello.wasm hello.class hello.nqp.moarvm hello.pir.pbc perl_storage.pst hello.beam empty.dtb hello-chez.so
base: $(NONBUNDLED_BLOBS)
@@ -65,3 +66,6 @@ hello.beam: hello.erl
empty.dtb: empty.dts
$(DTC) -o $@ -O dtb empty.dts
+
+hello-chez.so: hello-chez.ss
+ echo '(compile-file "hello-chez.ss")' | $(CHEZ) -q
diff --git a/test/fixtures/hello-chez.so b/test/fixtures/hello-chez.so
Binary files differ.
diff --git a/test/fixtures/hello-chez.ss b/test/fixtures/hello-chez.ss
@@ -0,0 +1,7 @@
+; SPDX-FileCopyrightText: 2019-2022 deblob Authors <https://hacktivis.me/projects/deblob>
+; SPDX-License-Identifier: BSD-3-Clause
+
+(import (rnrs base (6))
+ (rnrs io simple (6)))
+ (display "Hello world!")
+ (newline)