More about 2011/richards and macOS

This includes a minor code change. I believe at this point that it's an
inherent issue of macOS but I might be wrong. I'll certainly look at
this more in the future but I'm going to try and work on the remaining
README.md files first. Time will tell how much I succeed.
This commit is contained in:
Cody Boone Ferguson committed 2023-05-08 04:36:28 -07:00
1 parent 33a798c8cd
commit be793cc328
4 files changed
+152 -51

No files matched your search

+2 -2
View File
@@ -46,7 +46,7 @@ CWARN= -Wall -Wextra ${CSILENCE}
# Compiler standard
#
CSTD= -std=gnu11
CSTD= -std=gnu99
# Compiler bit architecture
#
@@ -65,7 +65,7 @@ CINCLUDE= -include stdlib.h -include string.h -include stdio.h -include ctype.h
# Optimization
#
OPT=
OPT=
# Default flags for ANSI C compilation
#
+5 -2
View File
@@ -15,14 +15,17 @@ make
./richards
```
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed a minor problem
that showed up in both linux and macOS. He notes however that as of this time
this entry does not work with macOS. See [bugs.md](/bugs.md) for more details.
Thank you Cody!
## Try:
```sh
echo '10 9 8 7 6 5 4 3 2 1*p*p*p*p*p*p*p*p*p' | ./richards
```
NOTE: this entry does not work in macOS. See [bugs.md](/bugs.md) for more
details.
## Judges' remarks:
+16 -12
View File
@@ -3,7 +3,10 @@
#endif
#include<setjmp.h>
#include<stdio.h>
#if !NM
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#ifndef NM
#include<sys/mman.h>
#endif
#define vo volatile
@@ -24,11 +27,11 @@
#define H 9<<16
#define I case
#define J(i) calloc(i,1)
#define W(c) e=(o*)memmove(e,x[(u)c],y[(u)c])+y[(u)c];
#define W(c) e=memmove(e,x[(u)c],y[(u)c])+y[(u)c];
#define N break; I
q char k;
q void o;
q unsigned long u;
q int u;
q o(*f) (vo o *);
q struct {
u *a, **R, *m, h, c;
@@ -43,7 +46,7 @@ u sk[H];
k *w;
o *x[H];
u y[H];
f *j, *e;
f j, e;
u l=256;
o g(u v)
{
@@ -59,7 +62,8 @@ f K(k * p, dt d)
{
k c, n = 0;
f r = (f) e;
W(1) while ((c = *p)) {
W(1)
while ((c = *p)) {
switch (c) {
I '#':
while (*++p != 10);
@@ -123,9 +127,9 @@ o T()
o rd(u v)
{
o *a = 0, **b = &a, **c = b + 24;
o *a = 0, **b = &a, **c = b + 32;
x[v] = w;
for (; b < c && (*b < (o *)w || *b > (o *) T || *b == (long) v); b++);
for (; b < c && (*b < (o *)w || *b > (o *) T || *b == &v); b++);
if (b == c) {
jmp_buf *j = alloca(sizeof(*j));
setjmp(*j);
@@ -146,7 +150,7 @@ o re(vo k * rec)
} F(d) M--;
*M /= M[1];
} F(p) printf("%lu\n", *M);
} F(p) printf("%d\n", *M);
} F(x) u n = *M--;
if (!S j[n])
@@ -162,8 +166,8 @@ M++;
lx(d);
}
}
o *lib1[] = { T, T, T, T, T } ;
o *lib2[] = { T, ld, lp, lx, l1 } ;
f *lib1[] = { T, T, T, T, T } ;
f *lib2[] = { T, ld, lp, lx, l1 } ;
int main()
{
@@ -189,10 +193,10 @@ int main()
S l = (f *) lib2;
S r = (f) T;
j = e =
#if NM
#ifdef NM
malloc(H);
#else
mmap(NULL, H, -1, MAP_ANON | MAP_PRIVATE, -1, 0);
(f)mmap(NULL, H, -1, MAP_ANON | MAP_PRIVATE, -1, 0);
#endif
while (b = fgets(malloc(999), 999, stdin))
((f) K(b, d)) (d);