diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-10-27 17:16:58 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-10-27 17:16:58 +0200 |
| commit | 989e933fc557cbc1e9e16e45033387816ee6075e (patch) | |
| tree | 867ee23bdaf6ba1e0e5f001d1a15e3bb46fa3bc3 /utils | |
| parent | 2a8d66906dde19ffb7315fb3f60a396a71612037 (diff) | |
| download | nissy-core-989e933fc557cbc1e9e16e45033387816ee6075e.tar.gz nissy-core-989e933fc557cbc1e9e16e45033387816ee6075e.zip | |
Improved transformations and cleaned up
Diffstat (limited to 'utils')
| -rwxr-xr-x | utils/gentranscode.sh | 11 | ||||
| -rw-r--r-- | utils/h48_to_src.c | 1 | ||||
| -rw-r--r-- | utils/invert.c | 19 |
3 files changed, 27 insertions, 4 deletions
diff --git a/utils/gentranscode.sh b/utils/gentranscode.sh index abc3480..f820d7c 100755 --- a/utils/gentranscode.sh +++ b/utils/gentranscode.sh | |||
| @@ -1,12 +1,17 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | gcc -DDEBUG h48_to_src.c ../src/cube.c | 3 | gcc -DDEBUG h48_to_src.c ../src/cube.c -o h48_to_src |
| 4 | gcc -DDEBUG invert.c ../src/cube.c -o invert | ||
| 4 | 5 | ||
| 5 | for f in transform_??_???.txt; do | 6 | for f in transform_??_???.txt; do |
| 6 | trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" | 7 | trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" |
| 7 | printf '[%s] = ' "$trans" | 8 | printf '[%s] = ' "$trans" |
| 8 | ./a.out <"$f" | 9 | if [ "$1" = "-i" ]; then |
| 10 | ./invert <"$f" | ./h48_to_src | ||
| 11 | else | ||
| 12 | ./h48_to_src <"$f" | ||
| 13 | fi | ||
| 9 | printf ',\n' | 14 | printf ',\n' |
| 10 | done | 15 | done |
| 11 | 16 | ||
| 12 | rm a.out | 17 | rm -f h48_to_src invert |
diff --git a/utils/h48_to_src.c b/utils/h48_to_src.c index b79e94b..97ee4bf 100644 --- a/utils/h48_to_src.c +++ b/utils/h48_to_src.c | |||
| @@ -14,7 +14,6 @@ int main() { | |||
| 14 | cube = readcube(H48, str); | 14 | cube = readcube(H48, str); |
| 15 | writecube(SRC, cube, str); | 15 | writecube(SRC, cube, str); |
| 16 | fputs(str, stdout); | 16 | fputs(str, stdout); |
| 17 | /* putc('\n', stdout); */ | ||
| 18 | 17 | ||
| 19 | return 0; | 18 | return 0; |
| 20 | } | 19 | } |
diff --git a/utils/invert.c b/utils/invert.c new file mode 100644 index 0000000..3088273 --- /dev/null +++ b/utils/invert.c | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | #include <inttypes.h> | ||
| 3 | #include <stdbool.h> | ||
| 4 | |||
| 5 | #include "../src/cube.h" | ||
| 6 | |||
| 7 | #define STRLENMAX 1000 | ||
| 8 | |||
| 9 | int main() { | ||
| 10 | char str[STRLENMAX]; | ||
| 11 | cube_t cube; | ||
| 12 | |||
| 13 | fgets(str, STRLENMAX, stdin); | ||
| 14 | cube = readcube(H48, str); | ||
| 15 | writecube(H48, inverse(cube), str); | ||
| 16 | fputs(str, stdout); | ||
| 17 | |||
| 18 | return 0; | ||
| 19 | } | ||
