proper headers
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
*.c text eol=lf diff=cpp whitespace=trailing-space,space-before-tab,tab-in-indent
|
||||||
|
*.h text eol=lf diff=cpp whitespace=trailing-space,space-before-tab,tab-in-indent
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#include "args.h"
|
||||||
|
|
||||||
|
parameters parse_args(int argc, char **argv) {
|
||||||
|
parameters params;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef ARGS_H
|
||||||
|
#define ARGS_H
|
||||||
|
|
||||||
|
struct Parameters {
|
||||||
|
unsigned long width;
|
||||||
|
unsigned long height;
|
||||||
|
char *file_path;
|
||||||
|
unsigned char start[3];
|
||||||
|
unsigned char slope[2];
|
||||||
|
unsigned char var[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct Parameters parameters;
|
||||||
|
|
||||||
|
parameters parse_args(int argc, char **argv);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "bmp.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ char *bmp_data_line(unsigned long width, unsigned int color_depth, char *data) {
|
|||||||
|
|
||||||
void bmp_generate(unsigned long width, unsigned long height,
|
void bmp_generate(unsigned long width, unsigned long height,
|
||||||
unsigned int color_depth, char *file_path,
|
unsigned int color_depth, char *file_path,
|
||||||
void generate_line(unsigned long y, char *data_buffer)) {
|
line_fn generate_line) {
|
||||||
FILE *fptr;
|
FILE *fptr;
|
||||||
fptr = fopen(file_path, "w");
|
fptr = fopen(file_path, "w");
|
||||||
char *header = bmp_header(width, height, color_depth);
|
char *header = bmp_header(width, height, color_depth);
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
|
#ifndef BMP_H
|
||||||
|
#define BMP_H
|
||||||
|
|
||||||
typedef void line_fn(unsigned long y, char *data_buffer);
|
typedef void line_fn(unsigned long y, char *data_buffer);
|
||||||
|
|
||||||
void bmp_generate(unsigned long width, unsigned long height,
|
void bmp_generate(unsigned long width, unsigned long height,
|
||||||
unsigned int color_depth, char *file_path, line_fn);
|
unsigned int color_depth, char *file_path,
|
||||||
|
line_fn generate_line);
|
||||||
|
|
||||||
|
#endif
|
||||||
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
#include "args.h"
|
||||||
#include "bmp.h"
|
#include "bmp.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@ void generate_line(unsigned long y, char *data_buffer) {
|
|||||||
memset(data_buffer, y, WIDTH * COLOR_DEPTH);
|
memset(data_buffer, y, WIDTH * COLOR_DEPTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate() {
|
void generate(parameters params) {
|
||||||
|
// TODO
|
||||||
bmp_generate(WIDTH, HEIGHT, COLOR_DEPTH, "test.bmp", generate_line);
|
bmp_generate(WIDTH, HEIGHT, COLOR_DEPTH, "test.bmp", generate_line);
|
||||||
}
|
}
|
||||||
+8
-1
@@ -1 +1,8 @@
|
|||||||
void generate();
|
#include "args.h"
|
||||||
|
|
||||||
|
#ifndef GENERATOR_H
|
||||||
|
#define GENERATOR_H
|
||||||
|
|
||||||
|
void generate(parameters params);
|
||||||
|
|
||||||
|
#endif
|
||||||
+4
-1
@@ -1,6 +1,9 @@
|
|||||||
|
#include "args.h"
|
||||||
#include "generator.h"
|
#include "generator.h"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
generate();
|
parameters params;
|
||||||
|
params = parse_args(argc, argv);
|
||||||
|
generate(params);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#ifndef MAIN_H
|
||||||
|
#define MAIN_H
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#ifndef RAND_H
|
||||||
|
#define RAND_H
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user