Skip to content

Commit a64721b

Browse files
committed
Add "BASIC" lang
The docker image is far from optimum but it works, so ship it!
1 parent 9d39e3a commit a64721b

File tree

11 files changed

+66
-3
lines changed

11 files changed

+66
-3
lines changed

build-langs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ for %langs{ @langs || * }:p.sort -> (:key($name), :value(%lang)) {
4747
given $name {
4848
my $digits = $ver ~~ / <[\d.]>+ \d+ /;
4949

50+
when 'BASIC' { $ver = "FreeBASIC $digits" }
5051
when 'C#'
5152
| 'F#'
5253
| 'PowerShell' { }

config/langs.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,25 @@ for arg; do
105105
done
106106
'''
107107

108+
[BASIC]
109+
size = '268 MiB'
110+
version = 'FreeBASIC 1.09.0'
111+
website = 'https://freebasic.net'
112+
example = '''
113+
' Printing
114+
Print "Hello, World!"
115+
116+
' Looping
117+
For i As UInteger = 0 To 9
118+
Print i
119+
Next
120+
121+
' Accessing arguments
122+
For i As Integer = 1 To __FB_ARGC__ - 1
123+
Print *__FB_ARGV__[i]
124+
Next
125+
'''
126+
108127
[brainfuck]
109128
size = '4.57 MiB'
110129
version = '3bdbd20'

css/golfer/holes.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ h3 { padding: .25rem 0 }
3434
input,
3535
input.assembly:not(:checked) ~ .assembly,
3636
input.bash:not(:checked) ~ .bash,
37+
input.basic:not(:checked) ~ .basic,
3738
input.brainfuck:not(:checked) ~ .brainfuck,
3839
input.c-sharp:not(:checked) ~ .c-sharp,
3940
input.c:not(:checked) ~ .c,
@@ -95,7 +96,7 @@ main svg:nth-of-type(2) {
9596

9697
@media (min-width: 95rem) {
9798
/* Increase this number when adding a language. */
98-
main { grid-template-columns: 4fr repeat(39, 1fr) }
99+
main { grid-template-columns: 4fr repeat(40, 1fr) }
99100

100101
main a { height: 1.9rem }
101102

db/a-schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ CREATE TYPE hole AS ENUM (
4444
CREATE TYPE keymap AS ENUM ('default', 'vim');
4545

4646
CREATE TYPE lang AS ENUM (
47-
'assembly', 'bash', 'brainfuck', 'c', 'c-sharp', 'cpp', 'cobol',
47+
'assembly', 'bash', 'basic', 'brainfuck', 'c', 'c-sharp', 'cpp', 'cobol',
4848
'crystal', 'd', 'elixir', 'f-sharp', 'fish', 'fortran', 'go', 'haskell',
4949
'hexagony', 'j', 'java', 'javascript', 'julia', 'k', 'lisp', 'lua', 'nim',
5050
'pascal', 'perl', 'php', 'powershell', 'prolog', 'python', 'raku', 'ruby',

docker/dev.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ COPY --from=codegolf/lang-swift ["/", "/langs/swift/rootfs/" ] # 561 M
1010
COPY --from=codegolf/lang-rust ["/", "/langs/rust/rootfs/" ] # 517 MiB
1111
COPY --from=codegolf/lang-haskell ["/", "/langs/haskell/rootfs/" ] # 309 MiB
1212
COPY --from=codegolf/lang-julia ["/", "/langs/julia/rootfs/" ] # 279 MiB
13+
COPY --from=codegolf/lang-basic ["/", "/langs/basic/rootfs/" ] # 268 MiB
1314
COPY --from=codegolf/lang-zig ["/", "/langs/zig/rootfs/" ] # 262 MiB
1415
COPY --from=codegolf/lang-d ["/", "/langs/d/rootfs/" ] # 245 MiB
1516
COPY --from=codegolf/lang-crystal ["/", "/langs/crystal/rootfs/" ] # 221 MiB

docker/live.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ COPY --from=codegolf/lang-swift ["/", "/langs/swift/rootfs/" ] # 561 M
2323
COPY --from=codegolf/lang-rust ["/", "/langs/rust/rootfs/" ] # 517 MiB
2424
COPY --from=codegolf/lang-haskell ["/", "/langs/haskell/rootfs/" ] # 309 MiB
2525
COPY --from=codegolf/lang-julia ["/", "/langs/julia/rootfs/" ] # 279 MiB
26+
COPY --from=codegolf/lang-basic ["/", "/langs/basic/rootfs/" ] # 268 MiB
2627
COPY --from=codegolf/lang-zig ["/", "/langs/zig/rootfs/" ] # 262 MiB
2728
COPY --from=codegolf/lang-d ["/", "/langs/d/rootfs/" ] # 245 MiB
2829
COPY --from=codegolf/lang-crystal ["/", "/langs/crystal/rootfs/" ] # 221 MiB

langs/basic/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM debian:bullseye-slim as builder
2+
3+
RUN apt-get update \
4+
&& apt-get install -y curl gcc libncurses-dev libtinfo5 xz-utils
5+
6+
RUN curl -L http://downloads.sourceforge.net/fbc/FreeBASIC-1.09.0-linux-x86_64.tar.xz \
7+
| tar xJ
8+
9+
RUN cd FreeBASIC-1.09.0-linux-x86_64 && ./install.sh -i /usr
10+
11+
FROM codegolf/lang-base
12+
13+
COPY --from=0 /bin /bin
14+
COPY --from=0 /lib /lib
15+
COPY --from=0 /lib64 /lib64
16+
COPY --from=0 /usr/bin /usr/bin
17+
COPY --from=0 /usr/include /usr/include
18+
COPY --from=0 /usr/lib /usr/lib
19+
COPY --from=0 /usr/libexec /usr/libexec
20+
21+
COPY basic /usr/bin/
22+
23+
ENTRYPOINT ["basic"]
24+
25+
CMD ["--version"]

langs/basic/basic

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh -e
2+
3+
[ "$1" = "--version" ] && exec /usr/bin/fbc "$@"
4+
5+
# Compile
6+
cd /tmp
7+
cat - > code.bas
8+
/usr/bin/fbc code.bas >&2
9+
rm code.bas
10+
11+
# Execute
12+
shift
13+
exec ./code "$@"

latest-langs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use TOML::Thumb;
55

66
constant @urls = (
77
'Bash' => 'Bash_(Unix_shell)',
8+
'BASIC' => 'FreeBASIC',
89
'C' => 'Tiny_C_Compiler',
910
'C#' => 'C_Sharp_(programming_language)',
1011
'COBOL' => 'GnuCOBOL',

run-lang.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ int main(__attribute__((unused)) int argc, char *argv[]) {
575575
ALLOW(ustat), // 136
576576

577577
// Miscellaneous (privileged)
578-
// ALLOW(ioperm), // 173
578+
ALLOW(ioperm), // 173 (FreeBASIC)
579579
// ALLOW(iopl), // 172
580580
// ALLOW(kexec_file_load), // 320
581581
// ALLOW(kexec_load), // 246

0 commit comments

Comments
 (0)