From 014e4835b50374f7c32b5982867c5633a90e34b9 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 18 Nov 2023 11:47:47 -0800 Subject: [PATCH] Add alt versions to 2004/gavare + formatting There already was one alt version which I found from the author's website about the entry; they used the version for development and it's unobfuscated. But two new ones were added. The most important feature is that it allows one to change the image size along with the anti-alias setting at compile time. This is gavare.alt.c. The second version (which also has the size/anti-alias changes) should theoretically work for Windows. This is gavare.alt2.c and running make alt will not try and compile it as most it'll fail on sane systems. Instead try make alt2. Both of these versions have some form of protection with the size/anti-alias setting and one does not have to define all three to get it to compile due to '#ifndef..#elif..#endif' in the code. The README.md file has been format/typo fixed. --- 2004/gavare/.gitignore | 1 + 2004/gavare/Makefile | 1 + 2004/gavare/README.md | 4 ++-- 2004/gavare/gavare.alt.c | 2 -- 2004/gavare/gavare.alt2.c | 18 ++++++++++++++++++ thanks-for-fixes.md | 8 ++++---- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/2004/gavare/.gitignore b/2004/gavare/.gitignore index 467749a32..baca81e1f 100644 --- a/2004/gavare/.gitignore +++ b/2004/gavare/.gitignore @@ -1,5 +1,6 @@ gavare gavare.alt +gavare.alt2 ioccc_ray.ppm gavare.r3 gavare.orig diff --git a/2004/gavare/Makefile b/2004/gavare/Makefile index 4a380e434..cd216a3e5 100644 --- a/2004/gavare/Makefile +++ b/2004/gavare/Makefile @@ -138,6 +138,7 @@ ${PROG}: ${PROG}.c alt: data ${ALT_TARGET} @${TRUE} +# alternative executable for Windows alt2: ${PROG}.alt2 @${TRUE} diff --git a/2004/gavare/README.md b/2004/gavare/README.md index 9dd9f9911..21c046b6c 100644 --- a/2004/gavare/README.md +++ b/2004/gavare/README.md @@ -31,8 +31,8 @@ entry](https://gavare.se/ioccc/ioccc_gavare.c.html) an unobfuscated version that was used during development, which we have included in the file [gavare.r3.c](gavare.r3.c). -Finally, there's an untested version for Windows, -[gavare.alt2.c](gavare.alt2.c), that sets binary mode on `stdout`. +Finally, there's a version, [gavare.alt2.c](gavare.alt2.c) that sets binary mode +on `stdout` which theoretically should work in Windows. ### Alternate build: diff --git a/2004/gavare/gavare.alt.c b/2004/gavare/gavare.alt.c index 510b5ffd5..85ef63d6b 100644 --- a/2004/gavare/gavare.alt.c +++ b/2004/gavare/gavare.alt.c @@ -4,14 +4,12 @@ #undef XX #define XX 1024 #endif - #ifndef YY #define YY 768 #elif YY < 1 #undef YY #define YY 768 #endif - #ifndef AA #define AA 3 #elif AA < 1 diff --git a/2004/gavare/gavare.alt2.c b/2004/gavare/gavare.alt2.c index 73fdd014a..6c0f0e372 100644 --- a/2004/gavare/gavare.alt2.c +++ b/2004/gavare/gavare.alt2.c @@ -1,6 +1,24 @@ #include #include #include +#ifndef XX +#define XX 1024 +#elif XX < 1 +#undef XX +#define XX 1024 +#endif +#ifndef YY +#define YY 768 +#elif YY < 1 +#undef YY +#define YY 768 +#endif +#ifndef AA +#define AA 3 +#elif AA < 1 +#define AA 3 +#endif + X=XX; Y=YY; A=AA; J=0;K=-10;L=-7;M=1296;N=36;O=255;P=9;_=1<<15;E;S;C;D;F(b){E="1""111886:6:??AAF" diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index e18ba68e7..15ef28a4a 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2689,13 +2689,13 @@ this. Cody added three different [alternate versions](2004/gavare/README.md#alternate-code): -- [gavare.alt.c](2004/gavare/gavare.alt.c): allows you to change the image size +- [gavare.alt.c](2004/gavare/gavare.alt.c) allows you to change the image size and anti-alias setting at compile time. -- [gavare.alt2.c](2004/gavare/gavare.alt2.c): like +- [gavare.alt2.c](2004/gavare/gavare.alt2.c) is like [gavare.alt.c](2004/gavare/gavare.alt.c) but it should work for Windows as well (it sets binary mode on `stdout`). -- [gavare.r3.c](2004/gavare/gavare.r3.c): the author's unobfuscated version that -was used during development, found on their [website about the +- [gavare.r3.c](2004/gavare/gavare.r3.c) is the author's unobfuscated version +that was used during development, found on their [website about the entry](https://gavare.se/ioccc/ioccc_gavare.c.html).