commit: d3bbf1c2a7776a643609069bb573cfc0bf28c4fa
parent d96b7cce263a34174bc3a1d954ff889acfbecc9a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 14 Jan 2023 06:14:26 +0100
Add support for Squirrel bytecode
Diffstat:
7 files changed, 17 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/pickle/*.pickle 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 test/fixtures/hello.n test/fixtures/hello-ocaml.* test/fixtures/compiled/hello-racket_rkt.zo test/fixtures/hello.elc
+Files: test/fixtures/pyc/*.pyc test/fixtures/pickle/*.pickle 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 test/fixtures/hello.n test/fixtures/hello-ocaml.* test/fixtures/compiled/hello-racket_rkt.zo test/fixtures/hello.elc test/fixtures/hello.cnut
Copyright: 2019-2022 deblob Authors <https://hacktivis.me/projects/deblob>
License: BSD-3-Clause
diff --git a/deblob.1 b/deblob.1
@@ -31,7 +31,7 @@ Pass the option multiple times to do multiple exclusions.
.It Fl d Ar working directory
Directory to be scanned rather than the current working directory on execution.
.El
-.Pp
+.Ss SUPPORTED FORMATS
Blobs scanned against are the following:
.Bl -dash -compact
.It
@@ -83,6 +83,8 @@ Racket bytecode
Emacs Lisp Bytecode
.It
Ren'Py Archives v1/v2/v3
+.It
+Squirrel 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
@@ -54,6 +54,8 @@ const magic: [_][]u8 = [
[0x78, 0x9c], // Ren'Py Archive v1
['R', 'P', 'A', '-', '2', '.', '0', ' '], // Ren'Py Archive v2
['R', 'P', 'A', '-', '3', '.', '0', ' '], // Ren'Py Archive v3
+
+ [0xFA, 0xFA], // Squirrel bytecode
];
const dos_magic: []u8 = ['M', 'Z'];
const pe_magic: []u8 = ['P', 'E', 0x00, 0x00];
@@ -124,6 +126,7 @@ fn is_blob(filename: str) (bool | fs::error | io::error) = {
(false, "test/fixtures/hello.lua"),
(false, "test/fixtures/hello.neko"),
(false, "test/fixtures/hello.nqp"),
+ (false, "test/fixtures/hello.nut"),
(false, "test/fixtures/hello.pir"),
(false, "test/fixtures/hello.py"),
(false, "test/fixtures/hello.wat"),
@@ -141,6 +144,7 @@ fn is_blob(filename: str) (bool | fs::error | io::error) = {
(true, "test/fixtures/hello.a"),
(true, "test/fixtures/hello.beam"),
(true, "test/fixtures/hello.class"),
+ (true, "test/fixtures/hello.cnut"),
(true, "test/fixtures/hello.elc"),
(true, "test/fixtures/hello.exe"),
(true, "test/fixtures/hello.luac53"),
@@ -256,7 +260,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) == 54);
+ assert(len(files_before) == 56);
const ret = check_dir(dirname);
assert(ret is void);
@@ -267,7 +271,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) == 29);
+ assert(len(files_after) == 30);
};
export fn main() void = {
diff --git a/test/fixtures/Makefile b/test/fixtures/Makefile
@@ -15,9 +15,10 @@ CHEZ ?= chezscheme
OCAMLC ?= ocamlc
OCAMLOPT ?= ocamlopt
EMACS ?= emacs
+SQUIRREL ?= squirrel3
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 hello-chez.so hello.n hello-ocaml.cmo hello-ocaml.cma hello-ocaml.cmx hello-ocaml.cmxa compiled/hello-racket_rkt.zo hello.elc
+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 hello.n hello-ocaml.cmo hello-ocaml.cma hello-ocaml.cmx hello-ocaml.cmxa compiled/hello-racket_rkt.zo hello.elc hello.cnut
base: $(NONBUNDLED_BLOBS)
@@ -93,3 +94,6 @@ compiled/hello-racket_rkt.zo: hello-racket.rkt
hello.elc: hello.el
$(EMACS) --eval '(byte-compile-file "hello.el")' --batch
+
+hello.cnut: hello.nut
+ $(SQUIRREL) -c -o $@ hello.nut
diff --git a/test/fixtures/README.md b/test/fixtures/README.md
@@ -15,6 +15,7 @@ Dependencies:
- [NekoVM Compiler](https://nekovm.org/)
- OCaml bytecode(ocamlc) and native(ocamlopt) compilers
- Racket
+- Squirrel
Rebuilding:
```
diff --git a/test/fixtures/hello.cnut b/test/fixtures/hello.cnut
Binary files differ.
diff --git a/test/fixtures/hello.nut b/test/fixtures/hello.nut
@@ -0,0 +1 @@
+print("Hello World!")