Add alt code 1989/westley

Unfortunately the fix to let the main program compile with clang even
breaks some versions generated (see compile.sh) in syntax error so even
gcc cannot compile those. Therefore it's now alt code. The alt version
will compile with clang and the main feature of the program will work
but the program cannot generate every version of the program.

The bugs.md and thanks-for-fixes.md have been updated along with the
README.md.

In the README.md there is a different heading level for the alt code
sections to compare to another as we try and figure out what heading
levels to use.

I changed the delay to 0 in the compile.sh script but one can set it to
another value if they like.

This entry will have to be worked on more at another time.
This commit is contained in:
Cody Boone Ferguson committed 2023-10-25 09:08:48 -07:00
1 parent 2469510d33
commit e51a012aa8
7 files changed
+92 -40

No files matched your search

+2 -2
View File
@@ -115,8 +115,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ= ver0.o ver1.o ver2.o ver3.o
ALT_TARGET= ver0 ver1 ver2 ver3
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
+35 -8
View File
@@ -10,9 +10,17 @@ US\
make all
```
### Bugs and (Mis)features
This entry a listed in [bugs.md](/bugs.md) as:
```
STATUS: main() function args not allowed - please help us fix
STATUS: known bug - please help us fix
```
For more detailed information see [bugs.md](/bugs.md#1989westley-readmemd).
NOTE: this entry only partly works with clang and only some versions of clang,
due to defects in the compiler. See [bugs.md](/bugs.md) for more details.
## Try:
@@ -51,20 +59,39 @@ Finally try:
```sh
./westley
# input some lines of text, sending EOF (usually ctrl-d) to end
echo IOCCC | ./westley
echo IOCCC | ./westley 1
echo IOCCC | ./westley 1 2
echo IOCCC | ./westley 1 2 3
echo IOCCC | ./ver0
echo Version 1 | ./ver1
echo Version 2 | ./ver2
echo Version 3 | ./ver3
```
## Alternate code:
### INAFIAB - it's not a feature it's a bug :-(
The alternate code allows SOME of the features to work with clang but some of
the code it generates (see [compile.sh](compile.sh), which does not use this
version) is not compilable even in gcc let alone clang. Nevertheless the main
feature should work for clang.
There might have been a segfault that was fixed in the original code but as we
no longer know what condition or conditions caused this we cannot be sure. It
seems like, according to various files, that `ver1` and/or `ver2` also have this
problem but we also do not know about the status of this. See
[bugs.md](/bugs.md) for more information.
### To build:
```sh
make alt
```
### Try:
```sh
echo IOCCC | ./westley.alt
echo IOCCC | ./westley.alt 1
echo IOCCC | ./westley.alt 1 2
echo IOCCC | ./westley.alt 1 2 3
```
+3 -5
View File
@@ -13,9 +13,7 @@
#
# CC=/opt/local/bin/gcc-mp-12 ./compile.sh
#
# We sleep (by default) for approximately 1 second after each command so that
# the you can read what is being done. If this is too fast you can change it in
# a similar way to the above but using the variable DELAY like so:
# If you wish to slow down the script you can use the DELAY variable like:
#
# DELAY=2 ./compile.sh
#
@@ -36,11 +34,11 @@ if [[ -z "$CC" ]]; then
fi
# get sleep duration
# we cannot use the form '${DELAY:=5}' because at least in some versions of bash
# we cannot use the form '${DELAY:=0}' because at least in some versions of bash
# it tries to invoke the command and obviously that won't work. Thus we check if
# it's empty before setting the default.
if [[ -z "$DELAY" ]]; then
DELAY=2
DELAY=0
fi
# make clobber to make the directory clean and then compile westley which we
+25
View File
@@ -0,0 +1,25 @@
/**//*/};)/**/main(/*//**/tang ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN
,ABBA(niam&&)))2-]--tang-[kri - =raeN(&&0<)/*clerk*/,noon,raeN)char
**gnat, **noon, **raeN;{int gn = gnat, ra = raeN, no = noon; (!tang&&
no!=-1&&(gn&2)&&((raeN&&( getchar(no+0)))||(1-ra&&(trgpune(no
)))))||tang&&znva(/*//**/tang ,tang,tang/**|**//*/((||)))0(enupgrt=raeN
(&&tang!(||)))0(rahcteg=raeN( &&1==tang((&&1-^)gnat=raeN(;;;)tang,gnat
,ABBA,0(avnz;)gnat:46+]552&)191+gnat([kri?0>]652%)191+gnat([kri=gnat
(&&)1-^gnat(&&)1& ABBA(!;)raeN,tang,gnat,ABBA(avnz&&0>ABBA{)raeN
,/**/);}znva(/*//**/tang,gnat,ABBA/**//*/(niam;}1-,78-,611-,321
-,321-,001-,64-,43-,801-,001-,301-,321-,511-,53-,54,44,34,24
,14,04,93,83,73,63,53,43,33,85,75,65,55,45,35,25,15,05,94,84
,74,64,0,0,0,0,0,0,/**/){ABBA='N'==65;(ABBA&&(gnat=trgpune
(0)))||(!ABBA&&(gnat=getchar(0-0)));(--tang&1)&&(gnat='n'<=
gnat&&gnat<='z'||'a'<=gnat&&gnat<='m'||'N'<=gnat&&gnat<='Z'
||'A'<=gnat&&gnat<='M'?(((gnat&/*//**/31/**//*/,21,11,01,9,8
,7,6,5,4,3,2,1,62,52,42,/**/)+12)%26)+(gnat&/*//**/32/**//*/,
22,12,02,91,81,71,61,51,41{=]652[kri};)/*pry*/)+65:gnat);main
(/*//**\**/tang^tang/**//*/,/* */,~/*//*-*/tang,gnat,ABBA-
0/**//*/(niam&&ABBA||))))tang( rahcteg&&1-1=<enrA(||))tang(
enupgrt&&1==enrA((&&)2&gnat(&& )1-^tang(&&ABBA!(;)85- =tang
(&&)'a\'=gnat(&&)1-==gnat(&&)4 ==ABBA(&&tang!;))))0(enupgrt=
gnat(&&)tang!((||)))0(rahcteg =gnat(&&tang((&&ABBA;;)1-'A'=!
'Z'=tang(&&ABBA{)enrA/***/);gnat ^-1&&znva(tang+1,gnat,1+gnat);
main(ABBA&2/*//*\\**/,tang,gnat ,ABBA/**//*/(avnz/**/);}/*//**/
+2 -3
View File
@@ -1,8 +1,7 @@
/**//*/};)/**/main(/*//**/tang ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN
,ABBA(niam&&)))2-]--tang-[kri - =raeN(&&0<)/*clerk*/,noon,raeN)char
**gnat, **noon, **raeN;{int gn = gnat, ra = raeN, no = noon; (!tang&&
no!=-1&&(gn&2)&&((raeN&&( getchar(no+0)))||(1-ra&&(trgpune(no
,ABBA(niam&&)))2-]--tang-[kri - =raeN(&&0<)/*clerk*/,noon,raeN){(!tang&&
noon!=-1&&(gnat&2)&&((raeN&&( getchar(noon+0)))||(1-raeN&&(trgpune(noon
)))))||tang&&znva(/*//**/tang ,tang,tang/**|**//*/((||)))0(enupgrt=raeN
(&&tang!(||)))0(rahcteg=raeN( &&1==tang((&&1-^)gnat=raeN(;;;)tang,gnat
,ABBA,0(avnz;)gnat:46+]552&)191+gnat([kri?0>]652%)191+gnat([kri=gnat