general: move code examples to a separate directory - #93
Merged
Conversation
klaudiagrz
reviewed
Aug 23, 2026
Comment on lines
+400
to
+401
| ;; Preserve the pointer to the current floating-point value in the r12 register, | ||
| ;; becase the strtod(3) may change it. |
Collaborator
There was a problem hiding this comment.
Suggested change
| ;; Preserve the pointer to the current floating-point value in the r12 register, | |
| ;; becase the strtod(3) may change it. | |
| ;; Preserve the pointer to the current floating-point value in the r12 register, | |
| ;; because the strtod(3) may change it. |
Comment on lines
+219
to
+224
| - `a` - tells the compiler to use the [`rax`](./asm_2.md) register. | ||
| - `b` - tells the compiler to use the [`rbx`](./asm_2.md) register. | ||
| - `c` - tells the compiler to use the [`rcx`](./asm_2.md) register. | ||
| - `d` - tells the compiler to use the [`rdx`](./asm_2.md) register. | ||
| - `S` - tells the compiler to use the [`rsi`](./asm_2.md) register. | ||
| - `D` - tells the compiler to use the [`rdi`](./asm_2.md) register. |
Collaborator
There was a problem hiding this comment.
Maybe would be better to add only one link? Could be as a sentence below:
For more information about registers, read...
| ;; the strtod(3) will finish its work. | ||
| mov rsi, end_buffer_1 | ||
| ;; Preserve the pointer to the current floating-point value in the r12 register, | ||
| ;; becase the strtod(3) may change it. |
Collaborator
There was a problem hiding this comment.
Suggested change
| ;; becase the strtod(3) may change it. | |
| ;; because the strtod(3) may change it. |
| ;; the strtod(3) will finish its work. | ||
| mov rsi, end_buffer_2 | ||
| ;; Preserve the pointer to the current floating-point value in the r12 register, | ||
| ;; becase the strtod(3) may change it. |
Collaborator
There was a problem hiding this comment.
Suggested change
| ;; becase the strtod(3) may change it. | |
| ;; because the strtod(3) may change it. |
|
|
||
| Besides the tools from the [Requirements](./README.md#requirements) section, the script needs [GCC](https://gcc.gnu.org/) to build the examples that interact with C, and [Python](https://www.python.org/) to run the examples that expect a terminal. | ||
|
|
||
| A new example also needs a `test_<name>` function in the script and an entry in the `example` list of the [Examples](./.github/workflows/examples.yaml) workflow. The same script runs in the continuous integration for every pull request, so a broken example fails the build. |
Collaborator
There was a problem hiding this comment.
Suggested change
| A new example also needs a `test_<name>` function in the script and an entry in the `example` list of the [Examples](./.github/workflows/examples.yaml) workflow. The same script runs in the continuous integration for every pull request, so a broken example fails the build. | |
| When adding a new example, you also need to add a `test_<name>` function in the script and an entry in the `example` list of the [Examples](./.github/workflows/examples.yaml) workflow. The same script runs in continuous integration for every pull request, so a broken example fails the build. |
Collaborator
There was a problem hiding this comment.
to make it clear that a contributor must do it
| expect_status "exits with success" 0 "${status}" | ||
|
|
||
| output="$("${EXAMPLES}/stack/stack" 5 | tr -d '\0')" | ||
| expect_output "complains about the number of arguments" \ |
|
|
||
| output="$("${EXAMPLES}/casm/casm3/casm" 2>&1)" | ||
| status=$? | ||
| expect_contains "complains about the number of arguments" \ |
| @@ -0,0 +1,20 @@ | |||
| # Code examples | |||
|
|
|||
| These are the example programs that accompany the book. Each directory is a standalone program with its own `Makefile` and `README.md`. | |||
Collaborator
There was a problem hiding this comment.
Suggested change
| These are the example programs that accompany the book. Each directory is a standalone program with its own `Makefile` and `README.md`. | |
| These are the sample programs that accompany the book. Each directory is a standalone program with its own `Makefile` and `README.md`. |
0xAX
force-pushed
the
move-examples
branch
2 times, most recently
from
August 24, 2026 13:33
2957a72 to
8710e18
Compare
klaudiagrz
approved these changes
Aug 25, 2026
| expect_status "exits with success" 0 "${status}" | ||
|
|
||
| output="$("${EXAMPLES}/stack/stack" 5 | tr -d '\0')" | ||
| expect_output "output contains error about the number of arguments" \ |
Collaborator
There was a problem hiding this comment.
Suggested change
| expect_output "output contains error about the number of arguments" \ | |
| expect_output "output contains an error about the number of arguments" \ |
|
|
||
| output="$("${EXAMPLES}/casm/casm3/casm" 2>&1)" | ||
| status=$? | ||
| expect_contains "output contains error about the number of arguments" \ |
Collaborator
There was a problem hiding this comment.
Suggested change
| expect_contains "output contains error about the number of arguments" \ | |
| expect_contains "output contains an error about the number of arguments" \ |
kshaffer42025-rgb
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR moves all code examples to a separate directory to make CI jobs easier. In the same time CI jobs to test code examples were added.
Related issues
#25