With the exception of lmfjyh which relies on a bug in gcc (that was
fixed in gcc 2.3.3) we have got all 1993 entries to compile under linux.
A couple will not compile under macOS and this is because gcc under
macOS is actually clang despite what many might have you believe (see
below) which is more strict about the second and third arguments of
main().
In a couple entries we used patches from Yusuke Endoh. Thank you Yusuke!
In others we (that is I aka Cody / @xexyl) fixed them (myself). There
was a question to be answered about whether to add #include lines to the
files themselves or add -includes to the Makefile. Since there are
pending changes to the Makefiles which will affect the CFLAGS (and
there's no CINCLUDE variable in these Makefiles yet) we opted for
updating the source files themselves.
One more note about the Makefiles: the 1993/Makefile was modified but I
added an XXX note to it to indicate that it should be fixed once the
other Makefiles are fixed. Specifically it now allows from 1993 one
to run `make' and compile the entries. The comment has what it used to
read and should be but for now is not because of a problem in the other
Makefiles.
As far as gcc under macOS as you can see it is not actually gcc but
clang:
$ /usr/bin/gcc -v 2>&1|head -n 1
Apple clang version 14.0.0 (clang-1400.0.29.202)
If you were to use clang -v under linux you might see something like:
$ clang -v 2>&1|head -n 1
clang version 15.0.7 (Fedora 15.0.7-1.fc37)
and with gcc:
$ gcc --version |head -n 1
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)
If you do by chance have gcc compiled and installed under macOS these
entries will probably work there.
130 lines
1.7 KiB
C
130 lines
1.7 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <time.h>
|
|
|
|
#define A(x) (e^d)&i?e:(e+=i+i/15-d,d<<=4,i<<=4,x)
|
|
#define B b+=!((e^d)&i)&&(d|=i),i<<=4,
|
|
#define C i=15,B B B B d=d<<4|d>>12,
|
|
#define D=(d=g,b=0,C b<<=4, C C C b)
|
|
#define E if(**y)goto
|
|
#define F=a[rand()%c]
|
|
#define G unsigned short
|
|
#define H e^=a[z],a[z]^=e,e^=a[z],
|
|
|
|
int
|
|
main
|
|
(int
|
|
z,char
|
|
**y)
|
|
{G*a
|
|
,b,c
|
|
,d,e
|
|
,f,g
|
|
,h,i
|
|
;*(*
|
|
y+=
|
|
strlen
|
|
(*y)
|
|
-1)^=
|
|
'd';
|
|
srand
|
|
(time
|
|
(0))
|
|
;z==
|
|
2&&
|
|
sscanf
|
|
(y[1
|
|
],"%d"
|
|
,&z)
|
|
&&z?
|
|
0:(z
|
|
=6);
|
|
if(!
|
|
(a=(
|
|
G*)
|
|
calloc(
|
|
z*z*
|
|
z*z,
|
|
sizeof
|
|
(G))
|
|
)){
|
|
printf
|
|
("No\
|
|
memory\
|
|
\n");
|
|
exit
|
|
(1);
|
|
}for
|
|
(c=1
|
|
;i=15
|
|
,d=z
|
|
,c<z
|
|
*z*z
|
|
*z&&
|
|
(e=a
|
|
[c-1
|
|
]+1,
|
|
a[c]
|
|
=A(A
|
|
(A(A
|
|
(0))
|
|
)),1
|
|
);c++
|
|
);*(
|
|
**y?
|
|
&g:&
|
|
e)F;
|
|
do{
|
|
printf
|
|
("(%d): ????\b\b\b\b"
|
|
,c);E
|
|
q0;else
|
|
goto
|
|
q1;q0:
|
|
printf
|
|
("%04X\n"
|
|
,g+
|
|
4369
|
|
);E
|
|
q2;q1:
|
|
scanf
|
|
("%hx"
|
|
,**y
|
|
?&h:
|
|
&g);
|
|
E q3
|
|
;g-=
|
|
4369
|
|
;q2:
|
|
printf
|
|
("??\b\b"
|
|
);E q1;
|
|
printf(
|
|
"%02x\n"
|
|
,h D
|
|
);q3
|
|
:for
|
|
(z=f
|
|
=0;(
|
|
z<c||
|
|
(c=f
|
|
,0))
|
|
&&(H
|
|
b D!=
|
|
h,H b
|
|
||(a[
|
|
f++]=
|
|
a[z])
|
|
,1);z
|
|
++);
|
|
}while
|
|
(h!=
|
|
64&&
|
|
c>0&&
|
|
((g F
|
|
),1)
|
|
);printf
|
|
("\n"
|
|
);}
|