Make progress in 1989/westley - alt code now main
The code that was the alt code now works entirely with gcc! The ver2 and ver3 do not yet work with clang but the other versions do so it seems appropriate to make this the main version and remove the alt code and alt scripts. I will continue to work on this in between the README.md files but this feels like great progress and as it was all I felt up to at this time it is definitely worth the effort and time.
This commit is contained in:
1 parent
f04b9b695d
commit
eb9e69fde6
6 files changed
+40
-120
No files matched your search
+5
-26
@@ -60,7 +60,7 @@ ARCH=
|
||||
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
CDEFINE= -Dtrgpune=putchar -Dpune=char -Dvag=int
|
||||
CDEFINE= -Dtrgpune=putchar -Dpune=char -Dvag=int -Dznva=main
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
@@ -115,8 +115,8 @@ OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ= ${PROG}.alt.o
|
||||
ALT_TARGET= ${PROG}.alt
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
|
||||
#################
|
||||
@@ -140,9 +140,6 @@ ${PROG}: ${PROG}.c
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
${ALT_TARGET}: ${PROG}.alt.c
|
||||
${CC} ${CFLAGS} -Dznva=main $< -o $@ ${LDFLAGS}
|
||||
|
||||
ver0: ${PROG}
|
||||
-./${PROG} < westley.c > ver0.c
|
||||
-${CC} ${CFLAGS} ver0.c -o $@ ${LDFLAGS}
|
||||
@@ -155,30 +152,12 @@ ver1: ${PROG}
|
||||
ver2: ${PROG}
|
||||
-./${PROG} 1 2 < westley.c > ver2.c
|
||||
@echo "** NOTE: this version will not compile with clang **"
|
||||
-${CC} ${CFLAGS} ver2.c -o $@ ${LDFLAGS}
|
||||
-${CC} ${CFLAGS} -Uznva ver2.c -o $@ ${LDFLAGS}
|
||||
|
||||
ver3: ${PROG}
|
||||
-./${PROG} 1 2 3 < westley.c > ver3.c
|
||||
@echo "** NOTE: this version will not compile with clang **"
|
||||
-${CC} ${CFLAGS} ver3.c -o $@ ${LDFLAGS}
|
||||
|
||||
alt.ver0: ${PROG}.alt
|
||||
-./${PROG}.alt < westley.alt.c > alt.ver0.c
|
||||
-${CC} ${CFLAGS} -Dznva=main alt.ver0.c -o $@ ${LDFLAGS}
|
||||
|
||||
alt.ver1: ${PROG}.alt
|
||||
-./${PROG}.alt 1 < westley.alt.c > alt.ver1.c
|
||||
-${CC} ${CFLAGS} -Dznva=main alt.ver1.c -o $@ ${LDFLAGS}
|
||||
|
||||
alt.ver2: ${PROG}.alt
|
||||
-./${PROG}.alt 1 2 < westley.alt.c > alt.ver2.c
|
||||
@echo "** NOTE: this alt version will not currently compile **"
|
||||
-${CC} ${CFLAGS} -Dznva=main alt.ver2.c -o $@ ${LDFLAGS}
|
||||
|
||||
alt.ver3: ${PROG}.alt
|
||||
-./${PROG}.alt 1 2 3 < westley.alt.c > alt.ver3.c
|
||||
@echo "** NOTE: this alt version will not currently compile **"
|
||||
-${CC} ${CFLAGS} -Dznva=main alt.ver3.c -o $@ ${LDFLAGS}
|
||||
-${CC} ${CFLAGS} -Uznva ver3.c -o $@ ${LDFLAGS}
|
||||
|
||||
|
||||
# data files
|
||||
|
||||
+1
-28
@@ -40,7 +40,7 @@ CC=/opt/local/bin/gcc-mp-12 ./compile.sh
|
||||
If you wish to delay the script or remove the delay you can do so like:
|
||||
|
||||
```sh
|
||||
DELAY=0 ./compile.sh
|
||||
DELAY=2 ./compile.sh
|
||||
```
|
||||
|
||||
Finally try:
|
||||
@@ -52,33 +52,6 @@ Finally try:
|
||||
./try.sh # demo of some input
|
||||
```
|
||||
|
||||
## Alternate code:
|
||||
|
||||
The alternate code allows SOME of the features to work with clang but some of
|
||||
the code it generates (see [compile.alt.sh](compile.alt.sh) is not compilable
|
||||
even in gcc let alone clang. Nevertheless the main feature should work and the
|
||||
same goes for the `alt.ver0` and `alt.ver1`; currently `alt.ver2` and `alt.ver3`
|
||||
will not compile even with gcc but it is nonetheless generated for when it is
|
||||
(hopefully) fixed.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```sh
|
||||
make alt
|
||||
```
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```sh
|
||||
./westley.alt
|
||||
# input some text
|
||||
|
||||
# generate alt code versions:
|
||||
./compile.alt.sh
|
||||
|
||||
./try.alt.sh # demo of some input
|
||||
```
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
|
||||
/**//*/;)/**/pain(/*//**/tang ,gnat/**//*/,ABBA~,0-0(avnc-0,tang,raeN
|
||||
,ABBA(niam&&)))2-]--tang-[kri - =raeN(&&0<)/*clerk*/,noon,raeN){(!tang&&
|
||||
noon!=-1&&(gnat&2)&&((raeN&&( getchar(noon+0)))||(1-raeN&&(trgpune(noon
|
||||
)))))||tang&&cnva(/*//**/tang ,tang/**|**//*/((||)))0(enupgrt=raeN
|
||||
(&&tang!(||)))0(rahcteg=raeN( &&1==tang((&&1-^)gnat=raeN(;;;)tang,gnat
|
||||
,ABBA,0(avnc;)gnat:46+]552&)191+gnat([kri?0>]652%)191+gnat([kri=gnat
|
||||
(&&)1-^gnat(&&)1& ABBA(!;)raeN,tang,gnat,ABBA(avnz&&0>ABBA{)raeN
|
||||
,/**/);}cnva(/*//**/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);pain
|
||||
(/*//**\**/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&&cnva(tang+1,gnat);
|
||||
pain(ABBA&2/*//*\\**/,tang,gnat ,ABBA/**//*/(avnc/**/);}/*//**/
|
||||
main(tang/*//*\\**/,gnat ,noon/**//*/(avnz/**/)char**gnat,
|
||||
**noon/**/;{pain/**\\*/ (tang,gnat,noon,0);}/*//**/
|
||||
@@ -1,24 +1,24 @@
|
||||
|
||||
/**//*/};)/**/main(/*//**/tang ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN
|
||||
/**//*/};)/**/pain(/*//**/tang ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN
|
||||
,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&&main(/*//**/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
|
||||
,/**/);}main(/*//**/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
|
||||
,74,64,0,0,0,0,0,0,/**/)char**gnat,**ABBA;{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
|
||||
||'A'<=(int)gnat&&gnat<='M'?((((int)gnat&/*//**/31/**//*/,21,11,01,9,8
|
||||
,7,6,5,4,3,2,1,62,52,42,/**/)+12)%26)+((int)gnat&/*//**/32/**//*/,
|
||||
22,12,02,91,81,71,61,51,41{=]652[kri};)/*pry*/)+65:gnat);pain
|
||||
(/*//**\**/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/**/);}/*//**/
|
||||
'Z'=tang(&&ABBA{)enrA/***/);(int)gnat ^-1&&znva(tang+1,gnat,1+gnat);
|
||||
pain((int)ABBA&2/*//*\\**/,tang,gnat ,ABBA/**//*/(avnz/**/);}/*//**/
|
||||
@@ -236,8 +236,9 @@ Please help us by writing alternative code!
|
||||
## STATUS: main() function args not allowed - please help us fix
|
||||
|
||||
NOTE: it appears that all of these have been fixed except perhaps for
|
||||
[1989/westley](1989/westley/westley.c). However some still have problems of some
|
||||
kind or another. This is what the status means, however.
|
||||
[1989/westley](1989/westley/westley.c) which has only been partly fixed. However
|
||||
some still have problems of some kind or another. This is what the status means,
|
||||
however.
|
||||
|
||||
Entries with this status have a problem in that the args to main() are not of a
|
||||
specific type due to this being allowed in earlier C. Some compilers like clang
|
||||
@@ -513,22 +514,17 @@ numbers with non-binary digits.
|
||||
## [1989/westley](1989/westley/westley.c) ([README.md](1989/westley/README.md))
|
||||
### STATUS: main() function args not allowed - please help us fix
|
||||
|
||||
This entry is a big problem for clang due to the way it is designed. An alt
|
||||
code, added by Cody, was made that lets the program work and some of the
|
||||
generated files work but as `ver2` and `ver3` cannot be compiled even with gcc
|
||||
(syntax errors) this is in the alt version.
|
||||
This entry is a big problem for clang due to the way it is designed; only the
|
||||
first (the same as the original) and second (`ver1.c`) will compile with clang.
|
||||
However all will compile with clang. Cody has made good progress and he intends
|
||||
to work on it more, hopefully solving it, but at this time only gcc will fully
|
||||
work. This is better than it was when there had to be alt code because some
|
||||
versions did not compile with any compiler, not just clang.
|
||||
|
||||
The problems with clang is that it does not allow `int` for any arg in `main()`
|
||||
except the first one, argc, and some versions of clang do not even allow a
|
||||
fourth arg at all (0, 2 or 3 args only).
|
||||
|
||||
Cody noted that trying to fix it in some cases causes a segfault and in other
|
||||
cases it fails to generate some of the files (others are okay) at all (empty
|
||||
files). These changes were never committed.
|
||||
|
||||
The file [westley.alt.c](1989/westley/westley.alt.c) will compile with clang
|
||||
but although it can perform some of its functions.
|
||||
The `ver2` and `ver3` cannot be compiled with clang due to wrong arg types to
|
||||
`main()` and in some versions of clang, too many args to `main()`.
|
||||
|
||||
With gcc, however, all the versions work.
|
||||
|
||||
### STATUS: known bug - please help us fix
|
||||
|
||||
|
||||
+13
-15
@@ -763,28 +763,26 @@ not his only reason :-) )
|
||||
## [1989/westley](1989/westley/westley.c) ([README.md](1989/westley/README.md]))
|
||||
|
||||
Cody got some of the versions (the original and `ver0` and `ver1`) to work with some
|
||||
versions of `clang`. Unfortunately there are some defects in `clang` that break
|
||||
this entry either in full or in part. In particular the first arg to `main()`
|
||||
has to be an int and the rest have to be a `char **` but some versions do not
|
||||
allow four args. So to get past this another function was added, `pain()`, which
|
||||
takes the place of `main()` and which `main()` calls.
|
||||
versions of `clang`; all the versions work with gcc.
|
||||
|
||||
This was added as alt code because some of the code generated cannot be compiled
|
||||
by gcc either. To make use of this several scripts were added by Cody.
|
||||
Unfortunately there are some defects in `clang` that break this entry either in
|
||||
full or in part. In particular the first arg to `main()` has to be an int and
|
||||
the rest have to be a `char **` but some versions do not allow four args. So to
|
||||
get past this another function was added, `pain()`, which takes the place of
|
||||
`main()` and which `main()` calls.
|
||||
|
||||
Originally alt code, Cody got it to all versions to work with gcc so it is no
|
||||
longer an alt version.
|
||||
|
||||
To make use of this several scripts were added by Cody.
|
||||
|
||||
The [compile.sh](1989/westley/compile.sh) script that removes the generated
|
||||
code, rebuilds the program and regenerates the other code and then compiles it
|
||||
will work for compilers like gcc and one can then use the
|
||||
[try.sh](1989/westley/try.sh) script to see example input and output.
|
||||
|
||||
The [compile.alt.sh](1989/westley/compile.alt.sh) script does the same but for
|
||||
the alt code, which as noted above, can only compile the first two generated
|
||||
versions, at least at this time. The [try.alt.sh](1989/westley/try.alt.sh)
|
||||
script is like the [try.sh](1989/westley/try.sh) script but it uses the alt code
|
||||
and alt generated versions instead.
|
||||
|
||||
Both scripts allow one to specify the compiler which is probably more useful for
|
||||
`compile.sh`.
|
||||
The `compile.sh` script allows one to specify the compiler with the `CC`
|
||||
environmental variable; see the README.md for details.
|
||||
|
||||
|
||||
## [1990/baruch](1990/baruch/baruch.c) ([README.md](1990/baruch/README.md]))
|
||||
|
||||
Reference in new issue
Block a user