Merge pull request #945 from xexyl/1990-dds
This commit is contained in:
2 files changed
+14
-4
No files matched your search
+3
-2
@@ -6,13 +6,14 @@
|
||||
#define X ;break;case
|
||||
#define _ return
|
||||
#define R 999
|
||||
#define gets(x) fgets((x),R,stdin)
|
||||
typedef char*A;int*C,E[R],L[R],M[R],P[R],l,i,j;char B[R],F[2];A m[12*R],malloc
|
||||
(),p,q,x,y,z,s,d;FILE *f;A Q(s,o)A s,o;{for(x=s;*x;x++){for(y=x,z=o;*z&&*y==
|
||||
*z;y++)z++;if(z>o&&!*z)_ x;}_ 0;}main(){m[11*R]="E";while(puts("Ok"),fgets(B,R,stdin),
|
||||
*z;y++)z++;if(z>o&&!*z)_ x;}_ 0;}main(){m[11*R]="E";while(puts("Ok"),gets(B),
|
||||
B[strlen(B)-1]='\0',1)switch(*B){X'R':C=E;l=1;for(i=0;i<R;P[i++]=0);while(l){while(!(s=m[l]))l++;if
|
||||
(!Q(s,"\"")){U("<>",'#');U("<=",'$');U(">=",'!');}d=B;while(*F=*s){*s=='"'&&j
|
||||
++;if(j&1||!Q(" \t",F))*d++=*s;s++;}*d--=j=0;if(B[1]!='=')switch(*B){X'E':l=-1
|
||||
X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?fgets(p=B,R,stdin),P[*d]=S():(*(q=Q(B,"TH"))=0,p
|
||||
X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?gets(p=B),P[*d]=S():(*(q=Q(B,"TH"))=0,p
|
||||
=B+2,S()&&(p=q+4,l=S()-1))X'P':B[5]=='"'?*d=0,puts(B+6):(p=B+5,printf("%d\n",S
|
||||
()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i
|
||||
=B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[
|
||||
|
||||
+11
-2
@@ -388,14 +388,23 @@ judge and user the executioner? :-)
|
||||
Yusuke and Cody in conjunction fixed this for modern systems.
|
||||
|
||||
Yusuke added the comma operator for a binary expression with `free(3)` which is
|
||||
an error because `free()` returns void.
|
||||
an error because `free()` returns void. Cody then made it slightly more like the
|
||||
original in this way by redefining `free` to have the comma operator itself.
|
||||
|
||||
Cody removed the erroneous prototype to `fopen()` which caused a compiler error
|
||||
and he also made this use `fgets()` instead of `gets()` to make it safer and to
|
||||
prevent an annoying and potentially alarming warning at compiling and/or linking
|
||||
and/or runtime. He also changed a file to be a proper `FILE *` and fixed a typo
|
||||
and/or runtime.
|
||||
|
||||
Cody also changed a file to be a proper `FILE *` and fixed a typo
|
||||
in [LANDER.BAS](1990/dds/LANDER.BAS).
|
||||
|
||||
Later Cody improved the `gets()`/`fgets()` fix by redefining `gets()` to use
|
||||
`fgets()`. Notice that the original entry used `fgets()` in one case as it has
|
||||
to read from another file and in this place nothing was changed.
|
||||
|
||||
With these improvements the entry looks much more like the original.
|
||||
|
||||
|
||||
## [1990/jaw](1990/jaw/jaw.c) ([README.md](1990/jaw/README.md]))
|
||||
|
||||
|
||||
Reference in new issue
Block a user