From 81e819ca6b144fc4c4cd2f284992aa5c7bddb112 Mon Sep 17 00:00:00 2001 From: jacob gw Date: Mon, 1 Mar 2021 23:41:34 -0500 Subject: [PATCH 1/4] patches: make interpreter compat and make work if not in PATH --- patches/eowyn.sh | 4 ++-- patches/gollum.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/patches/eowyn.sh b/patches/eowyn.sh index 5a802f6..f9e7479 100755 --- a/patches/eowyn.sh +++ b/patches/eowyn.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # "I will be a shieldmaiden no longer, # nor vie with the great Riders, nor @@ -14,7 +14,7 @@ # # We run from the patches dir. Go there now if not already. -cd $(dirname $(which $0)) +cd $(dirname $(realpath $0)) pwd # Show it upon the screen so all shall be made apparent. # Create healed/ directory here if it doesn't already exist. diff --git a/patches/gollum.sh b/patches/gollum.sh index 423d376..6531044 100755 --- a/patches/gollum.sh +++ b/patches/gollum.sh @@ -1,12 +1,12 @@ -#!/bin/bash +#!/bin/sh # # "It isn't fair, my precious, is it, # to ask us what it's got in it's # nassty little pocketsess?" -# Gollum, The Hobbit, or There and Back Again +# Gollum, The Hobbit, or There and Back Again # -cd $(dirname $(which $0)) +cd $(dirname $(realpath $0)) f=$(basename ../exercises/$1*.zig .zig 2> /dev/null) b=../exercises/$f.zig a=../answers/$f.zig From a26c3eb36f655b1b14a532ba50a194dbf42d6c99 Mon Sep 17 00:00:00 2001 From: Joseph T Lyons Date: Tue, 2 Mar 2021 23:06:09 -0500 Subject: [PATCH 2/4] Cleaned up some extraneous whitespace characters --- .gitattributes | 1 - README.md | 1 - build.zig | 4 ++-- patches/README.md | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.gitattributes b/.gitattributes index 2ab768e..97386d9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,4 +14,3 @@ # Text files to always have LF (unix) line endings on checkout. *.sh text eol=lf *.zig text eol=lf - diff --git a/README.md b/README.md index de0a808..b5262f5 100644 --- a/README.md +++ b/README.md @@ -163,4 +163,3 @@ Planned exercises: The initial topics for these exercises were unabashedly cribbed from [ziglearn.org](https://ziglearn.org/). I've since moved things around in an order that I think best lets each topic build upon each other. - diff --git a/build.zig b/build.zig index 7892117..8d1debd 100644 --- a/build.zig +++ b/build.zig @@ -345,7 +345,7 @@ pub fn build(b: *Builder) void { \\ _ _ _ \\ ___(_) __ _| (_)_ __ __ _ ___ \\ |_ | |/ _' | | | '_ \ / _' / __| - \\ / /| | (_| | | | | | | (_| \__ \ + \\ / /| | (_| | | | | | | (_| \__ \ \\ /___|_|\__, |_|_|_| |_|\__, |___/ \\ |___/ |___/ \\ @@ -522,7 +522,7 @@ const ZiglingStep = struct { zig_args.append(@tagName(builder.color)) catch unreachable; } - const zig_file = std.fs.path.join(builder.allocator, &[_][]const u8{ + const zig_file = std.fs.path.join(builder.allocator, &[_][]const u8{ if (self.use_healed) "patches/healed" else "exercises", self.exercise.main_file }) catch unreachable; zig_args.append(builder.pathFromRoot(zig_file)) catch unreachable; diff --git a/patches/README.md b/patches/README.md index b3249fa..c249949 100644 --- a/patches/README.md +++ b/patches/README.md @@ -32,4 +32,3 @@ $ zig build -Dhealed [step] Another Bash shell script named `gollum.sh` may also be found. He snatches the original answers and stows them in his secret answers stash. If you leave him alone, he'll leave you alone. - From 2e6afa058202caa5d7c0895c7da253e3937833e7 Mon Sep 17 00:00:00 2001 From: David Forester Date: Thu, 4 Mar 2021 19:55:26 -0600 Subject: [PATCH 3/4] found a Zig enum with a method --- exercises/48_methods2.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exercises/48_methods2.zig b/exercises/48_methods2.zig index 37b182c..14192f6 100644 --- a/exercises/48_methods2.zig +++ b/exercises/48_methods2.zig @@ -66,3 +66,6 @@ fn visitElephants(first_elephant: *Elephant) void { // name or alias in a comment below this one and make a // pull request on GitHub for a piece of eternal Ziglings // glory. The first five (5) PRs will be accepted! + +drforester - I found one in the Zig source. See link below: +https://github.com/ziglang/zig/blob/041212a41cfaf029dc3eb9740467b721c76f406c/src/Compilation.zig#L2495 From 8f732047b541c606182d81f47ab45b5b5259f223 Mon Sep 17 00:00:00 2001 From: Dave Gauer Date: Fri, 5 Mar 2021 09:22:20 -0500 Subject: [PATCH 4/4] Update 48_methods2.zig --- exercises/48_methods2.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/48_methods2.zig b/exercises/48_methods2.zig index 14192f6..f97710d 100644 --- a/exercises/48_methods2.zig +++ b/exercises/48_methods2.zig @@ -66,6 +66,6 @@ fn visitElephants(first_elephant: *Elephant) void { // name or alias in a comment below this one and make a // pull request on GitHub for a piece of eternal Ziglings // glory. The first five (5) PRs will be accepted! - -drforester - I found one in the Zig source. See link below: -https://github.com/ziglang/zig/blob/041212a41cfaf029dc3eb9740467b721c76f406c/src/Compilation.zig#L2495 +// +// 1) drforester - I found one in the Zig source: +// https://github.com/ziglang/zig/blob/041212a41cfaf029dc3eb9740467b721c76f406c/src/Compilation.zig#L2495