diff --git a/bin/input.c b/bin/input.c deleted file mode 100644 index 30d388b..0000000 --- a/bin/input.c +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include - -#define RGB_COLOR 255 - -typdef struct{ - unsigned char red, green, blue; -} colorChannel_t; - -typdef struct{ - int x,y; - colorChannel *data; -} imagePixel_t; - -static imagePixel_t *readPPM( const char *fileName ) { - char buffer[16]; - imagePixel_t *image; - int c, rgbColor; - - FILE *fp = fopen(fileName, "r"); - if( !fp ) { - exit(EXIT_FAILURE); - } - if( !fgets(buffer, sizeof(buffer), fp); - perror(filename); - exit(EXIT_FAILURE); - } - if( buffer[0] != 'P' || buffer[1] != '6' ) { - fprintf(stderr, "Invalid file format \n"); - exit(EXIT_FAILURE); - } - image = (imagePixel_t *) malloc(sizeof(imagePixel_t)); - if( !image ) { - fprintf(stderr, "malloc() failed"); - } - c = getc(fp); - while( c == '#' ) { - while( getc(fp) !='\n' ) { - c = getc(fp); - } - ungetc(c, fp); - if( scanf(fp, "%d %d", $image->, &img->) != 2 ) { - fprintf(stderr, "Invalid image size in %s\n)", filename); - exit(EXIT_FAILURE); - } - if( rgbColor != RGB_COLOR ) { - fprintf(stderr,"Invalid image color range in %s\n", filename); - exit(EXIT_FAILURE); - } - while(fgetc(fp) != '\n') { - image.data = (imagePixel_t *) malloc(image.x * image.y * sizeof(imagePixel_t)); - if ( !img ) { - fprintf(stderr, "malloc() failed"); - exit(EXIT_FAILURE); - } - if ( fread( image.data, 3 * image.x, image.y, fp ) != img.y ) { - fprintf(stderr, "Loading image failed"); - exit(EXIT_FAILURE); - } - } - fclose( fp ); - return image; -} - -int *mkPpmTestArray (int* testarray, imagePixel_t *image ) { - int i; - int output [image.x * image.y] - if ( !image ) { - for ( i = 0; i < image.x * image.y>; i++ ) { - // image.data[i].red = RGB_COLOR - image[i].red; - // image.data[i].green = RGB_COLOR - image.data[i].green; - // image.data[i].blue = RGB_COLOR - image.data[i].blue; - output[i] = image.data[i].red; - } - } -} - - -void main ( void ) { - char *fN = "beaches.ppm" - int testarray [1024]; - imagePixel_t result; - result = readPPM(fN); - mkPpmTestArray(testarray, result); - for (int i = 0; i < 1023; i++ ) { - printf("%d\n", testArray[i]; - } -} - - diff --git a/src/ansi_c_implementation/a.out b/src/ansi_c_implementation/a.out deleted file mode 100755 index 9b56f83..0000000 Binary files a/src/ansi_c_implementation/a.out and /dev/null differ diff --git a/src/ansi_c_implementation/lms b/src/ansi_c_implementation/lms index 34efa88..4b2ada4 100755 Binary files a/src/ansi_c_implementation/lms and b/src/ansi_c_implementation/lms differ diff --git a/src/ansi_c_implementation/signedunsigned.c b/src/ansi_c_implementation/signedunsigned.c deleted file mode 100644 index f24a157..0000000 --- a/src/ansi_c_implementation/signedunsigned.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -void main ( void ) { - unsigned ui_one = 1; - signed i_one = 1; - signed short s_minus_one = -1; - - if ( s_minus_one > ui_one ) { - printf("-1 > 1\n"); - } - if ( s_minus_one < i_one ) { - printf("-1 < 1\n"); - } -}