diff options
author | pommicket <leonardomtenenbaum@gmail.com> | 2016-06-19 12:48:45 -0400 |
---|---|---|
committer | pommicket <leonardomtenenbaum@gmail.com> | 2016-06-19 12:48:45 -0400 |
commit | ce071a9d599b53c3678e705feb68644bdc8a211d (patch) | |
tree | 3fc1f0154c3dc3d7b46b0d012838fd4d20106c08 /AutoImages | |
parent | f30243385b6eaebaf143bf4d98a0b14d6ed02e78 (diff) |
Fixed AutoImages problem
Diffstat (limited to 'AutoImages')
-rwxr-xr-x | AutoImages/AutoImages (renamed from AutoImages/bin/GNULinux/AutoImages) | bin | 123336 -> 123376 bytes | |||
-rwxr-xr-x | AutoImages/AutoImages.exe | bin | 0 -> 285852 bytes | |||
-rw-r--r-- | AutoImages/bin/Windows/AutoImages.exe | bin | 120826 -> 0 bytes | |||
-rw-r--r-- | AutoImages/src/Matrix.h | 10 | ||||
-rw-r--r-- | AutoImages/src/main.c | 10 |
5 files changed, 16 insertions, 4 deletions
diff --git a/AutoImages/bin/GNULinux/AutoImages b/AutoImages/AutoImages Binary files differindex c740f8e..85794d5 100755 --- a/AutoImages/bin/GNULinux/AutoImages +++ b/AutoImages/AutoImages diff --git a/AutoImages/AutoImages.exe b/AutoImages/AutoImages.exe Binary files differnew file mode 100755 index 0000000..7a3c07d --- /dev/null +++ b/AutoImages/AutoImages.exe diff --git a/AutoImages/bin/Windows/AutoImages.exe b/AutoImages/bin/Windows/AutoImages.exe Binary files differdeleted file mode 100644 index 802a9f8..0000000 --- a/AutoImages/bin/Windows/AutoImages.exe +++ /dev/null diff --git a/AutoImages/src/Matrix.h b/AutoImages/src/Matrix.h index d471811..41abced 100644 --- a/AutoImages/src/Matrix.h +++ b/AutoImages/src/Matrix.h @@ -18,6 +18,16 @@ matrix* matrix_alloc(int size1, int size2) return m; } +matrix* cpy_matrix(matrix* m) +{ + matrix* cpy = matrix_alloc(m->size1, m->size2); + int i, j; + for (i = 0; i < m->size1; i++) + for (j = 0; j < m->size2; j++) + cpy->array[i][j] = m->array[i][j]; + return cpy; +} + matrix* sin_matrix(matrix* m) { int i, j; diff --git a/AutoImages/src/main.c b/AutoImages/src/main.c index f4212c2..5ec4cf6 100644 --- a/AutoImages/src/main.c +++ b/AutoImages/src/main.c @@ -14,7 +14,7 @@ #include "Random.h" -#define FUNCTION_LENGTH 40 +#define FUNCTION_LENGTH 20 @@ -133,9 +133,9 @@ matrix* evalFunction(char* function, int width, int height) } if (strEquals(token, "x")) - push(stack, x); + push(stack, cpy_matrix(x)); else if (strEquals(token, "y")) - push(stack, y); + push(stack, cpy_matrix(y)); else if (strEquals(token, "sin")) push(stack, sin_matrix(pop(stack))); else if (strEquals(token, "cos")) @@ -211,7 +211,9 @@ matrix* evalFunction(char* function, int width, int height) token = strtok(NULL, " "); } - + + printf("This should be 77: %d\n", x->array[77][21]); + printf("This should be 27: %d\n", y->array[77][27]); return pop(stack); } |