Merge pull request #150 from xexyl/2001-bellard
This commit is contained in:
5 files changed
+65
-42
No files matched your search
@@ -1 +1,2 @@
|
|||||||
bellard
|
bellard
|
||||||
|
bellard.otccex
|
||||||
@@ -19,6 +19,17 @@ make
|
|||||||
./bellard file
|
./bellard file
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) partially fixed this
|
||||||
|
but he notes that this will not work without some serious debugging. As he has
|
||||||
|
no 32-bit system to test this under it's also unlikely he will be able to
|
||||||
|
resolve the remaining problems. He also has no knowledge of the ELF binary
|
||||||
|
format so that will also make it harder to work. As it is it segfaults. He fixed
|
||||||
|
an earlier segfault so that at least the file can be opened and he also changed
|
||||||
|
some of the macro uses to what they expanded to but mostly he kept it the same.
|
||||||
|
He also fixed `bellard.otccex.c` so it does not segfault and seemingly works
|
||||||
|
okay. Thank you Cody for your assistance!
|
||||||
|
|
||||||
|
|
||||||
### Try:
|
### Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
+35
-34
@@ -1,4 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#define k *(int*)
|
#define k *(int*)
|
||||||
#define a if(
|
#define a if(
|
||||||
#define c ad()
|
#define c ad()
|
||||||
@@ -10,14 +12,13 @@
|
|||||||
#define f ()
|
#define f ()
|
||||||
#define J return
|
#define J return
|
||||||
#define l ae(
|
#define l ae(
|
||||||
#define n e)
|
|
||||||
#define u d!=
|
#define u d!=
|
||||||
#define F int
|
#define F int
|
||||||
#define y (j)
|
#define y (j)
|
||||||
#define r m=
|
#define r m=
|
||||||
#define t +4
|
#define t +4
|
||||||
F d,z,C,h,P,K,ac,q,G,v,Q,R,D,L,W,M;
|
F d,z,C,h,P,K,ac,q,G,v,Q,R,D,L,W,M;
|
||||||
E(n{
|
E(int e){
|
||||||
x D++=e;
|
x D++=e;
|
||||||
}
|
}
|
||||||
o f{
|
o f{
|
||||||
@@ -131,43 +132,43 @@ x q++=g;
|
|||||||
g=g>>8;
|
g=g>>8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
A(n{
|
A(int e){
|
||||||
F g;
|
F g;
|
||||||
p n{
|
p e){
|
||||||
g=k e;
|
g=k e;
|
||||||
k e=q-e-4;
|
k e=q-e-4;
|
||||||
e=g;
|
e=g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s(g,n{
|
s(int g,int e){
|
||||||
l g);
|
l g);
|
||||||
k q=e;
|
k q=e;
|
||||||
e=q;
|
e=q;
|
||||||
q=q t;
|
q=q t;
|
||||||
J e;
|
J e;
|
||||||
}
|
}
|
||||||
H(n{
|
H(e){
|
||||||
s(184,n;
|
s(184,e);
|
||||||
}
|
}
|
||||||
B(n{
|
B(e){
|
||||||
J s(233,n;
|
J s(233,e);
|
||||||
}
|
}
|
||||||
S(j,n{
|
S(int j,int e){
|
||||||
l 1032325);
|
l 1032325);
|
||||||
J s(132+j,n;
|
J s(132+j,e);
|
||||||
}
|
}
|
||||||
Z(n{
|
Z(int e){
|
||||||
l 49465);
|
l 49465);
|
||||||
H(0);
|
H(0);
|
||||||
l 15);
|
l 15);
|
||||||
l e+144);
|
l e+144);
|
||||||
l 192);
|
l 192);
|
||||||
}
|
}
|
||||||
N(j,n{
|
N(int j,int e){
|
||||||
l j+131);
|
l j+131);
|
||||||
s((e<512)<<7|5,n;
|
s((e<512)<<7|5,e);
|
||||||
}
|
}
|
||||||
T y{
|
T (int j){
|
||||||
F g,e,m,aa;
|
F g,e,m,aa;
|
||||||
g=1;
|
g=1;
|
||||||
a d b 34){
|
a d b 34){
|
||||||
@@ -221,7 +222,7 @@ w f;
|
|||||||
l 89);
|
l 89);
|
||||||
l 392+(e b 256));
|
l 392+(e b 256));
|
||||||
}
|
}
|
||||||
i a n{
|
i a e){
|
||||||
a e b 256)l 139);
|
a e b 256)l 139);
|
||||||
i l 48655);
|
i l 48655);
|
||||||
q++;
|
q++;
|
||||||
@@ -264,7 +265,7 @@ k r j;
|
|||||||
c;
|
c;
|
||||||
a!g){
|
a!g){
|
||||||
e=e t;
|
e=e t;
|
||||||
k e=s(232,k n;
|
k e=s(232,k e);
|
||||||
}
|
}
|
||||||
i a g b 1){
|
i a g b 1){
|
||||||
s(2397439,j);
|
s(2397439,j);
|
||||||
@@ -276,11 +277,11 @@ s(232,g-q-5);
|
|||||||
a j)s(50305,j);
|
a j)s(50305,j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
O y{
|
O (int j){
|
||||||
F e,g,m;
|
F e,g,m;
|
||||||
a j--b 1)T(1);
|
a j--b 1)T(1);
|
||||||
i{
|
i{
|
||||||
O y;
|
O (j);
|
||||||
r 0;
|
r 0;
|
||||||
p j b C){
|
p j b C){
|
||||||
g=d;
|
g=d;
|
||||||
@@ -288,17 +289,17 @@ e=z;
|
|||||||
c;
|
c;
|
||||||
a j>8){
|
a j>8){
|
||||||
r S(e,m);
|
r S(e,m);
|
||||||
O y;
|
O (j);
|
||||||
}
|
}
|
||||||
i{
|
i{
|
||||||
l 80);
|
l 80);
|
||||||
O y;
|
O (j);
|
||||||
l 89);
|
l 89);
|
||||||
a j b 4|j b 5){
|
a j b 4|j b 5){
|
||||||
Z(n;
|
Z(e);
|
||||||
}
|
}
|
||||||
i{
|
i{
|
||||||
l n;
|
l e);
|
||||||
a g b 37)l 146);
|
a g b 37)l 146);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,7 +309,7 @@ r S(e,m);
|
|||||||
H(e^1);
|
H(e^1);
|
||||||
B(5);
|
B(5);
|
||||||
A(m);
|
A(m);
|
||||||
H(n;
|
H(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,19 +320,19 @@ U f{
|
|||||||
w f;
|
w f;
|
||||||
J S(0,0);
|
J S(0,0);
|
||||||
}
|
}
|
||||||
I y{
|
I (int j){
|
||||||
F m,g,e;
|
F m,g,e;
|
||||||
a d b 288){
|
a d b 288){
|
||||||
c;
|
c;
|
||||||
c;
|
c;
|
||||||
r U f;
|
r U f;
|
||||||
c;
|
c;
|
||||||
I y;
|
I (j);
|
||||||
a d b 312){
|
a d b 312){
|
||||||
c;
|
c;
|
||||||
g=B(0);
|
g=B(0);
|
||||||
A(m);
|
A(m);
|
||||||
I y;
|
I (j);
|
||||||
A(g);
|
A(g);
|
||||||
}
|
}
|
||||||
i{
|
i{
|
||||||
@@ -357,7 +358,7 @@ a u 41){
|
|||||||
e=B(0);
|
e=B(0);
|
||||||
w f;
|
w f;
|
||||||
B(g-q-5);
|
B(g-q-5);
|
||||||
A(n;
|
A(e);
|
||||||
g=e t;
|
g=e t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -369,7 +370,7 @@ A(m);
|
|||||||
i a d b 123){
|
i a d b 123){
|
||||||
c;
|
c;
|
||||||
ab(1);
|
ab(1);
|
||||||
p u 125)I y;
|
p u 125)I (j);
|
||||||
c;
|
c;
|
||||||
}
|
}
|
||||||
i{
|
i{
|
||||||
@@ -386,7 +387,7 @@ i a u 59)w f;
|
|||||||
c;
|
c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ab y{
|
ab (int j){
|
||||||
F m;
|
F m;
|
||||||
p d b 256|u-1&!j){
|
p d b 256|u-1&!j){
|
||||||
a d b 256){
|
a d b 256){
|
||||||
@@ -428,11 +429,11 @@ k r G;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
main(g,n{
|
int main(int g,char **e){
|
||||||
Q=stdin;
|
Q=stdin;
|
||||||
a g-->1){
|
a g-->1){
|
||||||
e=e t;
|
*e=e[1];
|
||||||
Q=fopen(k e,"r");
|
Q=fopen(*e,"r");
|
||||||
}
|
}
|
||||||
D=strcpy(R V," int if else while break return for define main ")+48;
|
D=strcpy(R V," int if else while break return for define main ")+48;
|
||||||
v V;
|
v V;
|
||||||
@@ -441,6 +442,6 @@ P V;
|
|||||||
o f;
|
o f;
|
||||||
c;
|
c;
|
||||||
ab(0);
|
ab(0);
|
||||||
J(*(int(*)f)k(P+592))(g,n;
|
J(*(int(*)f)k(P+592))(g,e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,13 +72,13 @@ print_num(n, b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 'main' takes standard 'argc' and 'argv' parameters */
|
/* 'main' takes standard 'argc' and 'argv' parameters */
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* no local name space is supported, but local variables ARE
|
/* no local name space is supported, but local variables ARE
|
||||||
supported. As long as you do not use a globally defined
|
supported. As long as you do not use a globally defined
|
||||||
variable name as local variable (which is a bad habbit), you
|
variable name as local variable (which is a bad habbit), you
|
||||||
won't have any problem */
|
won't have any problem */
|
||||||
int s, n, f, base;
|
int n, f, base;
|
||||||
|
|
||||||
/* && and || operator have the same semantics as C (left to right
|
/* && and || operator have the same semantics as C (left to right
|
||||||
evaluation and early exit) */
|
evaluation and early exit) */
|
||||||
@@ -86,15 +86,14 @@ main(argc, argv)
|
|||||||
/* '*' operator is supported with explicit casting to 'int *',
|
/* '*' operator is supported with explicit casting to 'int *',
|
||||||
'char *' or 'int (*)()' (function pointer). Of course, 'int'
|
'char *' or 'int (*)()' (function pointer). Of course, 'int'
|
||||||
are supposed to be used as pointers too. */
|
are supposed to be used as pointers too. */
|
||||||
s = *(int *)argv;
|
help(argv[0]);
|
||||||
help(s);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* Any libc function can be used because OTCC uses dynamic linking */
|
/* Any libc function can be used because OTCC uses dynamic linking */
|
||||||
n = atoi(*(int *)(argv + 4));
|
n = atoi(argv[1]);
|
||||||
base = DEFAULT_BASE;
|
base = DEFAULT_BASE;
|
||||||
if (argc >= 3) {
|
if (argc >= 3) {
|
||||||
base = atoi(*(int *)(argv + 8));
|
base = atoi(argv[2]);
|
||||||
if (base < 2 || base > 36) {
|
if (base < 2 || base > 36) {
|
||||||
/* external variables can be used too (here: 'stderr') */
|
/* external variables can be used too (here: 'stderr') */
|
||||||
fprintf(stderr, "Invalid base\n");
|
fprintf(stderr, "Invalid base\n");
|
||||||
@@ -118,7 +117,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* functions can be used before being defined */
|
/* functions can be used before being defined */
|
||||||
help(name)
|
help(char *name)
|
||||||
{
|
{
|
||||||
printf("usage: %s n [base]\n", name);
|
printf("usage: %s n [base]\n", name);
|
||||||
printf("Compute fib(n) and fact(n) and output the result in base 'base'\n");
|
printf("Compute fib(n) and fact(n) and output the result in base 'base'\n");
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ _README.md_ file. If you're a previous winner we will add a link to your winning
|
|||||||
entries in the file (if you're not we can add a link to your personal website if
|
entries in the file (if you're not we can add a link to your personal website if
|
||||||
you have one if you like).
|
you have one if you like).
|
||||||
|
|
||||||
# List of Statuses - Please read before fixing (you may skip if you're only interested in entries with known issues)
|
# List of Statuses - Please read before fixing (you may skip if you're only interested in knowing about entries with known issues)
|
||||||
|
|
||||||
Entries below have one of the following _Status_ values.
|
Entries below have one of the following _Status_ values.
|
||||||
|
|
||||||
@@ -385,6 +385,17 @@ on. Note that it needs to be compiled as a x86 program.
|
|||||||
warning in their comments on that.
|
warning in their comments on that.
|
||||||
|
|
||||||
|
|
||||||
|
## [2001/bellard](2001/bellard/bellard.c) ([README.md](2001/bellard/README.md))
|
||||||
|
|
||||||
|
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed an initial
|
||||||
|
segfault and he also fixed the [supplementary
|
||||||
|
program](2001/bellard/bellard.otccex.c) to test the entry on to not segfault and
|
||||||
|
seemingly work but he has no 32-bit system to test any further fixes and we
|
||||||
|
would greatly appreciate anyone's help! It appears that this entry will require
|
||||||
|
major debugging and to make it work one might need to have a deep understanding
|
||||||
|
of the ELF format.
|
||||||
|
|
||||||
|
|
||||||
# 2004
|
# 2004
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user