proper headers

This commit is contained in:
2025-06-03 20:07:24 +02:00
parent 1ddb2fdea0
commit f12754da21
10 changed files with 60 additions and 5 deletions
+2
View File
@@ -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
+9
View File
@@ -0,0 +1,9 @@
#include "args.h"
parameters parse_args(int argc, char **argv) {
parameters params;
// TODO
return params;
}
+17
View File
@@ -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
+2 -1
View File
@@ -1,3 +1,4 @@
#include "bmp.h"
#include <stdio.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,
unsigned int color_depth, char *file_path,
void generate_line(unsigned long y, char *data_buffer)) {
line_fn generate_line) {
FILE *fptr;
fptr = fopen(file_path, "w");
char *header = bmp_header(width, height, color_depth);
+7 -1
View File
@@ -1,4 +1,10 @@
#ifndef BMP_H
#define BMP_H
typedef void line_fn(unsigned long y, char *data_buffer);
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
View File
@@ -1,3 +1,4 @@
#include "args.h"
#include "bmp.h"
#include <string.h>
@@ -9,6 +10,7 @@ void generate_line(unsigned long y, char *data_buffer) {
memset(data_buffer, y, WIDTH * COLOR_DEPTH);
}
void generate() {
void generate(parameters params) {
// TODO
bmp_generate(WIDTH, HEIGHT, COLOR_DEPTH, "test.bmp", generate_line);
}
+8 -1
View File
@@ -1 +1,8 @@
void generate();
#include "args.h"
#ifndef GENERATOR_H
#define GENERATOR_H
void generate(parameters params);
#endif
+4 -1
View File
@@ -1,6 +1,9 @@
#include "args.h"
#include "generator.h"
int main(int argc, char **argv) {
generate();
parameters params;
params = parse_args(argc, argv);
generate(params);
return 0;
}
+4
View File
@@ -0,0 +1,4 @@
#ifndef MAIN_H
#define MAIN_H
#endif
+4
View File
@@ -0,0 +1,4 @@
#ifndef RAND_H
#define RAND_H
#endif