Skip to content

Commit 00660df

Browse files
committed
Add very basic support for "J"
Updates #48
1 parent 696582f commit 00660df

File tree

8 files changed

+49
-14
lines changed

8 files changed

+49
-14
lines changed

assets/hole.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ h3 {
147147
#tabs {
148148
clear: both;
149149
display: grid;
150-
grid-template-columns: repeat(10, 1fr);
150+
grid-template-columns: repeat(11, 1fr);
151151
margin-top: 10px;
152152
position: relative;
153153
-moz-user-select: none;
@@ -188,7 +188,7 @@ h3 {
188188

189189
@keyframes spin { 100% { transform: rotate(1turn) } }
190190

191-
@media(max-width: 450px) { #tabs { grid-template-columns: repeat(5, 1fr) } }
191+
@media(max-width: 450px) { #tabs { grid-template-columns: repeat(6, 1fr) } }
192192

193193
@media(max-width: 970px) {
194194
#tabs a {

assets/hole.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ onload = function() {
2424
let editors = [];
2525

2626
for (let langName of [
27-
'Bash', 'Haskell', 'JavaScript', 'Lisp', 'Lua',
28-
'Perl', 'Perl 6', 'PHP', 'Python', 'Ruby',
27+
'Bash', 'Haskell', 'J', 'JavaScript', 'Lisp',
28+
'Lua', 'Perl', 'Perl 6', 'PHP', 'Python', 'Ruby',
2929
]) {
3030
let lang = langName.replace(/ /, '').toLowerCase();
3131

@@ -70,7 +70,7 @@ onload = function() {
7070

7171
( onhashchange = function() {
7272
// Kick 'em to Perl 6 if we don't know the chosen language.
73-
if (!/^#(?:bash|haskell|javascript|lisp|lua|perl6?|php|python|ruby)$/.exec(location.hash))
73+
if (!/^#(?:bash|haskell|j|javascript|lisp|lua|perl6?|php|python|ruby)$/.exec(location.hash))
7474
location.hash = 'perl6';
7575

7676
let lang = location.hash.slice(1);

assets/user.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ tr {
102102

103103
#matrix tr:first-child th:nth-child(2) { background-image: svg(bash#222) }
104104
#matrix tr:first-child th:nth-child(3) { background-image: svg(haskell#222) }
105-
#matrix tr:first-child th:nth-child(4) { background-image: svg(javascript#222) }
106-
#matrix tr:first-child th:nth-child(5) { background-image: svg(lisp#222) }
107-
#matrix tr:first-child th:nth-child(6) { background-image: svg(lua#222) }
108-
#matrix tr:first-child th:nth-child(7) { background-image: svg(perl#222) }
109-
#matrix tr:first-child th:nth-child(8) { background-image: svg(perl6#222) }
110-
#matrix tr:first-child th:nth-child(9) { background-image: svg(php#222) }
111-
#matrix tr:first-child th:nth-child(10) { background-image: svg(python#222) }
112-
#matrix tr:first-child th:nth-child(11) { background-image: svg(ruby#222) }
105+
#matrix tr:first-child th:nth-child(5) { background-image: svg(javascript#222) }
106+
#matrix tr:first-child th:nth-child(6) { background-image: svg(lisp#222) }
107+
#matrix tr:first-child th:nth-child(7) { background-image: svg(lua#222) }
108+
#matrix tr:first-child th:nth-child(8) { background-image: svg(perl#222) }
109+
#matrix tr:first-child th:nth-child(9) { background-image: svg(perl6#222) }
110+
#matrix tr:first-child th:nth-child(10) { background-image: svg(php#222) }
111+
#matrix tr:first-child th:nth-child(11) { background-image: svg(python#222) }
112+
#matrix tr:first-child th:nth-child(12) { background-image: svg(ruby#222) }

build-langs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ for name in Bash Haskell JavaScript Lisp Lua Perl Perl\ 6 PHP Python Ruby; do
1313
mkdir $lang/rootfs
1414

1515
# Tag the builder stage so "docker system prune" won't remove it.
16-
if [ $lang != haskell ]; then
16+
if [ $lang != haskell -a $lang != j ]; then
1717
docker build --target builder -t code-golf-$lang-builder $lang
1818
fi
1919

containers/j/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM alpine:edge
2+
3+
RUN apk add --no-cache bash binutils clang-dev curl fts-dev gcc libedit-dev make musl-dev
4+
5+
RUN curl -L https://github.com/jsoftware/jsource/archive/90adff2.tar.gz | tar xzf -
6+
7+
RUN mkdir -p ~/git ~/jbld/j64/bin \
8+
&& mv jsource-* ~/git/jsource \
9+
&& cd ~/git/jsource \
10+
&& echo '#define jversion "807"' > jsrc/jversion.h \
11+
&& echo '#define jplatform "linux"' >> jsrc/jversion.h \
12+
&& echo '#define jtype "build"' >> jsrc/jversion.h \
13+
&& echo '#define jlicense "GPL3"' >> jsrc/jversion.h \
14+
&& echo '#define jbuilder "www.jsoftware.com"' >> jsrc/jversion.h \
15+
&& . make/jvars.sh \
16+
&& make/build_jconsole.sh j64 \
17+
&& make/build_libj.sh j64
18+
19+
RUN apk del --no-cache bash binutils clang-dev curl fts-dev gcc make musl-dev
20+
21+
RUN mkdir /j \
22+
&& mv ~/git/jsource/jlibrary/* /j \
23+
&& mv /root/jbld/j64/bin/* /j/bin
24+
25+
RUN echo -e "#!/bin/sh -e\n\
26+
\n\
27+
/bin/cat - > /tmp/code.ijs\n\
28+
\n\
29+
exec /j/bin/jconsole /tmp/code.ijs \"\$@\"" > /usr/bin/j && chmod +x /usr/bin/j
30+
31+
ENTRYPOINT ["echo", "807"]

db.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ CREATE TYPE public.hole AS ENUM (
7575
CREATE TYPE public.lang AS ENUM (
7676
'bash',
7777
'haskell',
78+
'j',
7879
'javascript',
7980
'lisp',
8081
'lua',

routes/solution.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ func runCode(hole, lang, code string, args []string) (string, string) {
133133
cmd.Args = []string{"/usr/bin/bash", "-s", "-"}
134134
case "haskell", "javascript", "php":
135135
cmd.Args = []string{"/usr/bin/" + lang, "--"}
136+
case "j":
137+
cmd.Args = []string{"/usr/bin/j"}
136138
case "perl6":
137139
cmd.Args = []string{
138140
"/usr/bin/moar",

routes/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type Hole struct{ ID, Name, Difficulty, Preamble string }
66
var langs = []Lang{
77
{"bash", "Bash"},
88
{"haskell", "Haskell"},
9+
{"j", "J"},
910
{"javascript", "JavaScript"},
1011
{"lisp", "Lisp"},
1112
{"lua", "Lua"},

0 commit comments

Comments
 (0)