Commit graph

533 commits

Author SHA1 Message Date
Chris Boesch
d608f481e6
Update 096_memory_allocation.zig
formatting
2023-04-12 17:14:18 +02:00
Chris Boesch
336106d396
Update 097_bit_manipulation.zig
formatting
2023-04-12 17:13:51 +02:00
Chris Boesch
bcbf373bcd
Update 098_bit_manipulation2.zig
formatting
2023-04-12 17:10:54 +02:00
Chris Boesch
132e87d5bb
Update README.md
set check for 'bit manipulation'
2023-04-12 17:09:03 +02:00
Chris Boesch
311248356b
Merge pull request #233 from chrboesch/bit_manipulation
added the second exercise for bit manipulation
2023-04-12 17:08:06 +02:00
Chris Boesch
0293629a6c added the second exercise for bit manipulation 2023-04-12 17:00:26 +02:00
Chris Boesch
29d56c6c40
Merge pull request #232 from chrboesch/bit_manipulation
Bit manipulation
2023-04-12 15:52:27 +02:00
Chris Boesch
0c9147dba2 added first exercise for bit manipulation 2023-04-12 15:47:20 +02:00
Chris Boesch
6c08d03905 added first exercise for bit manipulation 2023-04-12 15:44:12 +02:00
Chris Boesch
87c9c29ffc
Merge pull request #224 from perillo/improve-build-more
build: enable full parallelism when -Dhealed is set
2023-04-12 15:27:48 +02:00
Manlio Perillo
96d3678ad1 build: make PrintStep thread safe
Update PrintStep to always printing to stderr, using std.debug.print, so
that the message is written atomically.

Note that currently it is not an issue, since PrintStep prints the
message before everything else.
2023-04-11 12:52:48 +02:00
Manlio Perillo
7bf0b9b7fd build: simplify the code when solving all the exercises
Initialize the first step in the chain to the header_step, instead of
making the code more complex handling the first step as a special case
in the for loop.
2023-04-11 12:45:55 +02:00
Manlio Perillo
0c995677c7 build: restore compatibility support
Commit 0d56ba3 (build: restore the exercise chain) broke the
compatibility support for old compilers, due to the use of the
multi-object for loop syntax.

Use the normal for loop syntax; the change still keep the code readable.

Use the variable `n`, instead of `i`, when referring to the exercise
number; this will improve the readability.

Closes #227
2023-04-11 12:45:55 +02:00
Manlio Perillo
edcb74a52b build: improve PrintStep, SkipStep and PatchStep names
Use lover case for the step names.

Add the exercise name for the SkipStep and PatchStep step name.
2023-04-11 12:45:55 +02:00
Manlio Perillo
a16d16bfd6 build: simplify code and add tests
Simplify the code finding the exercise number from the exercise index,
when the -Dn option is set.  This is now possible since the exercise
numbers have no holes.

Add the validate_exercises function to check that exercise number are in
the correct order, and call it at the start of the build function.

Add tests, with 2 test cases.
2023-04-11 12:45:55 +02:00
Manlio Perillo
60b8e481cf build: add support for skipping exercises
Currently, exercises not working with the current Zig compiler are
commented. This is problematic, since the exercise key and exercise
index are no longer consistent.

Add the skip field to the Excercise struct.  Update ZiglingStep to
support it and add a new SkipStep step to support it when using the
standard build step.
2023-04-11 12:45:55 +02:00
Manlio Perillo
33fbfd637a build: ensure the exercise links libc, when needed
When running, as an example, `zig build -Dhealed -Dn=93 test`, the build
fails, because the `test` step use the standard CompileStep, instead of
ZiglingStep.

Ensure that exercises using libc are correctly built.

Closes #229
2023-04-11 12:45:27 +02:00
Chris Boesch
90db09e17c
Update README.md 2023-04-09 19:40:39 +02:00
Chris Boesch
3b6a80f6f9
Merge pull request #226 from chrboesch/adjust_advance
Adjustment of the 'Advanced usage' in the README
2023-04-09 19:39:24 +02:00
Chris Boesch
4f9a290564 closes https://github.com/ratfactor/ziglings/issues/223 2023-04-09 19:25:04 +02:00
Manlio Perillo
b56bb7bace build: enable full parallelism when -Dhealed is set
The eowyn.sh script is used in a github workflow, but after
commit 0d56ba3 (build: restore the exercise chain), the github action
will take more time to complete.

Enable full build parallelism, when -Dhealed is true and -Dn is null.
Use the standard CompileStep and RunStep, instead of ZiglingStep.

On my PC, this change reduces the build time by about 30%.
2023-04-08 09:31:03 +02:00
Chris Boesch
718e7274d5
Update README.md
changed zig version number
2023-04-07 18:28:33 +02:00
Chris Boesch
0f54e2e515
Merge pull request #212 from perillo/improve-build
build: make the logo a build step
2023-04-07 18:24:42 +02:00
Chris Boesch
45ccfa7d3e Insert current zig version for compatiblity!
This is primarily to make users aware that there has been a change in the call for individual exercises.
2023-04-07 18:18:15 +02:00
Chris Boesch
f4408f9eb9 help text for parameters adapted 2023-04-07 18:06:13 +02:00
Manlio Perillo
0d56ba3ca3 build: restore the exercise chain
The new parallel build support in Zig broke the exercise chain, so that
each esercise check is no longer strictly serialized.

  1. Add the Dexno option, in order to isolate the chain starting from a
     named exercise from the normal chain, thus simplify the code.

     The current code have an additional issue: it added 4 x n steps,
     making reading the help message or the list of steps very hard.

     Add only the `install`, `uninstall`, `zigling`, `test` and `start`
     steps.  The last three steps match the old steps `n`, `n_test` and
     `n_start`.

     The default step is zigling (note the singular form).

     The `install` step override the builtin install step, showing a
     custom description and matches the old `n_install` step.
     The uninstall step was added for consistency, so that the
     description is consistent.

     Setup a new chain starting at `zig build -Dexno=n start` so that it
     is stricly serialized.

     The behavior should be the same as the old one.

  2. Handle the code for all the exercises separately.

     Add only the `ziglings step`, making it the default step, in
     addition to the install and uninstall steps.

     Setup a new chain starting at the first exercise, to that it is
     strictly serialized.

     The behavior should be the same as the old one.

The current code has a know issue: the messages from the ZiglingStep and
the ones from the compiler compilation progress are interleaved, but each
message is written atomically, due to the use of `std.debug.getStderrMutex()`.

Update the README.md file.

Closes #202
2023-04-07 11:36:26 +02:00
Manlio Perillo
7b793d8fd8 build: fix the description of the named_install step
Replace the description of the named_install step from
"Install {s} to zig-cache/bin" to "Copy {s} to prefix path".  The latter
has been adapded from the description of the builtin install step.

Ad an empty line before the build_step variable, in order to improve
readability.

Closes #213
2023-04-05 21:19:17 +02:00
Chris Boesch
d4fc1e5663
Merge pull request #216 from chrboesch/i215
improving the explanation
2023-04-05 16:30:51 +02:00
Chris Boesch
0f0f65e1e1 improving the explanation 2023-04-05 16:11:56 +02:00
Manlio Perillo
9354de09fb build: replace the logo step with the header step
Remove the logo step, and use PrintStep for the header step.

The logo step was added as a quick fix after the Builder.addLog function
was removed.

Now the logo is no longer shown when running `zig build -l` or
`zig build -h`.
2023-04-04 18:32:30 +02:00
Manlio Perillo
4bd2b6225e build: restore support for Zig 0.6.0
The version check for Zig 0.6.0 was incorrect since commit
971ab7f (Use a zig build script to run ziglings).

Move compatibility support to a separate file, in order to simplify
build.zig.

In case of incompatible version, exit with code 3 instead of 0, in order
to detect the case of failure in a test (to be implemented).

Remove the use of comptime when checking compatibility at the start of
the build function, since it is not necessary.

Closes #210.
2023-04-03 11:37:12 +02:00
Manlio Perillo
24478be7a2 build: make the logo a build step
Currently, the logo is always printed when the build script is executed,
resulting in the logo being printed twice with `zig build -h` and
`zig build -l`.

Make the logo a build step, so that the logo is printed to stderr only
when necessary.

Closes #211
2023-04-02 15:09:51 +02:00
Chris Boesch
a1c79f0324
Merge pull request #209 from chrboesch/e70
changed self parameter in connect to pointer
2023-03-31 12:31:15 +02:00
Chris Boesch
c4086ab252 changed self parameter in connect to pointer 2023-03-31 12:18:57 +02:00
Chris Boesch
b3d1ae677c
Merge pull request #208 from chrboesch/issue_140
function made more elegant
2023-03-30 23:22:09 +02:00
Chris Boesch
a3b2a58eab function made more elegant 2023-03-30 23:11:40 +02:00
Chris Boesch
e9735900ae
Merge pull request #207 from chrboesch/i205
changed self paramter in waddle to pointer
2023-03-30 22:49:10 +02:00
Chris Boesch
cf21274e73 changed self paramter in waddle to pointer 2023-03-30 22:42:44 +02:00
Chris Boesch
6ee7fc7451
Merge pull request #206 from ZoloZithro/my-branch
Exercise 094: Correct spelling and grammar

Thanks!
2023-03-30 16:40:49 +02:00
Zolo Zithro
b2c0c5d85e Exercise 094: Correct spelling and grammar 2023-03-30 09:40:13 -04:00
Chris Boesch
53597efcf3
Update README.md
change note to attention for new build system
2023-03-20 00:24:24 +01:00
Chris Boesch
acab9d3e1d
Merge pull request #203 from chrboesch/new_build
workaround for new build system
2023-03-19 18:28:47 +01:00
Chris Boesch
0d154fedf1 workaround for parallel processing of the build steps 2023-03-19 18:23:35 +01:00
Chris Boesch
59f9c485b4 first test for new build system 2023-03-19 00:59:42 +01:00
Dave Gauer
5315e7086e
Merge pull request #199 from joburgard/main
Fix typos
2023-03-15 18:52:16 -04:00
Jo Burgard
f4d850468b
Fix typo 2023-03-14 13:43:50 +01:00
Jo Burgard
1de824b6a5
Fix typo 2023-03-14 13:35:20 +01:00
Chris Boesch
c12d6c8507
Update README.md 2023-03-12 13:49:26 +01:00
Chris Boesch
d491f43896
Update README.md 2023-03-12 13:47:48 +01:00
Chris Boesch
31aeb28871
Update README.md
see https://github.com/ratfactor/ziglings/issues/198
2023-03-12 13:47:13 +01:00