o
odin.langpkg.dev
packages / library / mkheaders

mkheaders

v1.0library

Takes in C source files, produces a __function_index.h

No license · updated 1 year ago

mkheaders

Takes in C source files, produces a __function_index.h

mkheaders [SRC_DIRECTORY] [OUTPUT_FILE_NAME]

A simple cli tool I wrote over a Saturday, it parses out all the C files in a given directory, extracts all functions and puts them into a single header file automatically.

I generally like header files a lot and have no need to sync types/variables, but I am too lazy to keep adding the functions and I see no benefit over automating this proccess.

Output file sample:

#ifndef FUNCTION_INDEX_H
#define FUNCTION_INDEX_H
// This file has been automatically generated by Up05/mkheader

// file: render.c

Shader get_shader(Object shape);
vec calc_size(vec raw_size);
vec r_float(Origin origin, vec offset, vec size);
vec r_float_obj(Object shape);
Rectangle vec_to_rect(vec a, vec b);
void draw_sprite(Object shape, Sprite sprite);
void draw_color(Object shape);
void draw_shaded(Object shape);
void draw_object(Object object);
void draw_particle(Particle p);
void draw_perf_stats();
void draw_loss_screen();
void load_sprite(SpriteType type, str name);
void load_sprites();
void load_shader(ShaderType shader, str name);
void load_shaders();
void set_window_size();

// file: ents.c

bool intersecting(Object a, Object b);
void ball_spawn();
void rocket_spawn();
f32 sign(f32 n);
f32 clamp(f32 n, f32 lo, f32 hi);
void rocket_explode(Entity rocket, Entity* against);
void rocket_explode_timeout(Entity rocket);
f32 lerp(f32 a, f32 b, f32 t);
vec bezier_pos(Bezier p, f32 t);
void entity_update(Entity* entity);
void rocket_update(Entity* rocket);
void ball_update(Entity* ball);

...

#endif