Browse Source

Merge branch 'main' of github.com:ratfactor/ziglings into main

Dave Gauer 4 years ago
parent
commit
0fea5bc00c
7 changed files with 10 additions and 10 deletions
  1. 0 1
      .gitattributes
  2. 0 1
      README.md
  3. 2 2
      build.zig
  4. 3 0
      exercises/48_methods2.zig
  5. 0 1
      patches/README.md
  6. 2 2
      patches/eowyn.sh
  7. 3 3
      patches/gollum.sh

+ 0 - 1
.gitattributes

@@ -14,4 +14,3 @@
 # Text files to always have LF (unix) line endings on checkout.
 *.sh text eol=lf
 *.zig text eol=lf
-

+ 0 - 1
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.
-

+ 2 - 2
build.zig

@@ -348,7 +348,7 @@ pub fn build(b: *Builder) void {
         \\         _       _ _
         \\     ___(_) __ _| (_)_ __   __ _ ___
         \\    |_  | |/ _' | | | '_ \ / _' / __|
-        \\     / /| | (_| | | | | | | (_| \__ \ 
+        \\     / /| | (_| | | | | | | (_| \__ \
         \\    /___|_|\__, |_|_|_| |_|\__, |___/
         \\           |___/           |___/
         \\
@@ -525,7 +525,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;
 

+ 3 - 0
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!
+//
+// 1) drforester - I found one in the Zig source:
+// https://github.com/ziglang/zig/blob/041212a41cfaf029dc3eb9740467b721c76f406c/src/Compilation.zig#L2495

+ 0 - 1
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.
-

+ 2 - 2
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.

+ 3 - 3
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