# HG changeset patch # User David Demelier # Date 1677936239 -3600 # Node ID 6e8f6640e05bb883d8ed2c70d0263f7b5a1f3161 # Parent 6af0524913b34d2ad13887674ff44503065d656e misc: use extern C manually diff -r 6af0524913b3 -r 6e8f6640e05b doc/Doxyfile --- a/doc/Doxyfile Sat Mar 04 11:23:10 2023 +0100 +++ b/doc/Doxyfile Sat Mar 04 14:23:59 2023 +0100 @@ -42,4 +42,3 @@ ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES -PREDEFINED = MLK_CORE_BEGIN_DECLS MLK_CORE_END_DECLS diff -r 6af0524913b3 -r 6e8f6640e05b examples/CMakeLists.txt --- a/examples/CMakeLists.txt Sat Mar 04 11:23:10 2023 +0100 +++ b/examples/CMakeLists.txt Sat Mar 04 14:23:59 2023 +0100 @@ -23,7 +23,6 @@ example-action example-animation example-audio - example-battle example-cursor example-debug example-drawable diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/action-script.h --- a/libmlk-core/mlk/core/action-script.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/action-script.h Sat Mar 04 14:23:59 2023 +0100 @@ -45,8 +45,6 @@ #include -#include "core.h" - struct mlk_action; union mlk_event; @@ -90,7 +88,9 @@ size_t current; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif /** * Initialize the action sequence structure. @@ -184,6 +184,8 @@ void mlk_action_script_finish(struct mlk_action_script *script); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_ACTION_SCRIPT_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/action-stack.h --- a/libmlk-core/mlk/core/action-stack.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/action-stack.h Sat Mar 04 14:23:59 2023 +0100 @@ -32,8 +32,6 @@ #include -#include "core.h" - struct mlk_action; union mlk_event; @@ -63,7 +61,9 @@ size_t actionsz; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif /** * Initialize the action sequence structure. @@ -151,6 +151,8 @@ void mlk_action_stack_finish(struct mlk_action_stack *stack); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_ACTION_STACK_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/action.h --- a/libmlk-core/mlk/core/action.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/action.h Sat Mar 04 14:23:59 2023 +0100 @@ -34,8 +34,6 @@ * battles, maps, etc). */ -#include "core.h" - union mlk_event; /** @@ -118,7 +116,9 @@ void (*finish)(struct mlk_action *); }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif /** * Invoke ::mlk_action::start function if not null. @@ -176,6 +176,8 @@ void mlk_action_finish(struct mlk_action *action); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_ACTION_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/alloc.h --- a/libmlk-core/mlk/core/alloc.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/alloc.h Sat Mar 04 14:23:59 2023 +0100 @@ -124,8 +124,6 @@ #include -#include "core.h" - /** * \struct mlk_alloc_funcs * \brief Custom allocator @@ -170,7 +168,9 @@ void (*finalizer)(void *); }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif /** * Replace the memory allocators. @@ -284,6 +284,8 @@ void mlk_alloc_pool_finish(struct mlk_alloc_pool *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_ALLOC_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/animation.h --- a/libmlk-core/mlk/core/animation.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/animation.h Sat Mar 04 14:23:59 2023 +0100 @@ -29,8 +29,6 @@ * draw next frames depending on delay set. */ -#include "core.h" - struct mlk_sprite; /** @@ -59,7 +57,9 @@ /** \endcond MLK_PRIVATE_DECLS */ }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif /** * Start or reset the animation to the beginning. @@ -107,6 +107,8 @@ int mlk_animation_draw(const struct mlk_animation *animation, int x, int y); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_ANIMATION_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/clock.h --- a/libmlk-core/mlk/core/clock.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/clock.h Sat Mar 04 14:23:59 2023 +0100 @@ -29,8 +29,6 @@ * get the frame ticks instead. */ -#include "core.h" - /** * \struct mlk_clock * \brief Clock structure @@ -43,7 +41,9 @@ /** \endcond MLK_PRIVATE_DECLS */ }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif /** * Start or reset the clock. @@ -65,6 +65,8 @@ unsigned int mlk_clock_elapsed(const struct mlk_clock *clock); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_CLOCK_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/core.h --- a/libmlk-core/mlk/core/core.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/core.h Sat Mar 04 14:23:59 2023 +0100 @@ -27,15 +27,9 @@ */ #if defined(__cplusplus) -# define MLK_CORE_BEGIN_DECLS extern "C" { -# define MLK_CORE_END_DECLS } -#else -# define MLK_CORE_BEGIN_DECLS -# define MLK_CORE_END_DECLS +extern "C" { #endif -MLK_CORE_BEGIN_DECLS - /** * Initialize the libmlk-core library. * @@ -60,6 +54,8 @@ void mlk_core_finish(void); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_CORE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/drawable-stack.h --- a/libmlk-core/mlk/core/drawable-stack.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/drawable-stack.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,14 +21,14 @@ #include -#include "core.h" - struct mlk_drawable_stack { struct mlk_drawable **objects; size_t objectsz; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void mlk_drawable_stack_init(struct mlk_drawable_stack *); @@ -48,6 +48,8 @@ void mlk_drawable_stack_finish(struct mlk_drawable_stack *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_DRAWABLE_STACK_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/drawable.h --- a/libmlk-core/mlk/core/drawable.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/drawable.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_CORE_DRAWABLE_H #define MLK_CORE_DRAWABLE_H -#include "core.h" - struct mlk_drawable { void *data; int x; @@ -31,7 +29,9 @@ void (*finish)(struct mlk_drawable *); }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_drawable_update(struct mlk_drawable *, unsigned int); @@ -45,6 +45,8 @@ void mlk_drawable_finish(struct mlk_drawable *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_DRAWABLE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/event.h --- a/libmlk-core/mlk/core/event.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/event.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,7 +19,6 @@ #ifndef MLK_CORE_EVENT_H #define MLK_CORE_EVENT_H -#include "core.h" #include "key.h" #include "mouse.h" #include "gamepad.h" @@ -77,11 +76,15 @@ struct mlk_event_axis axis; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_event_poll(union mlk_event *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_EVENT_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/font.h --- a/libmlk-core/mlk/core/font.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/font.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,8 +21,6 @@ #include -#include "core.h" - struct mlk_texture; enum mlk_font_style { @@ -36,7 +34,9 @@ void *handle; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_font_open(struct mlk_font *, const char *, unsigned int); @@ -59,6 +59,8 @@ void mlk_font_finish(struct mlk_font *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_FONT_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/game.h --- a/libmlk-core/mlk/core/game.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/game.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,7 +21,6 @@ #include -#include "core.h" #include "inhibit.h" struct mlk_state; @@ -37,7 +36,9 @@ extern struct mlk_game game; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void mlk_game_init(struct mlk_state **, size_t); @@ -63,6 +64,8 @@ void mlk_game_quit(void); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_GAME_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/gamepad.h --- a/libmlk-core/mlk/core/gamepad.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/gamepad.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,10 +19,6 @@ #ifndef MLK_CORE_GAMEPAD_H #define MLK_CORE_GAMEPAD_H -#include "core.h" - -MLK_CORE_BEGIN_DECLS - enum mlk_gamepad_button { MLK_GAMEPAD_BUTTON_UNKNOWN, MLK_GAMEPAD_BUTTON_A, @@ -63,6 +59,10 @@ int end; }; +#if defined(__cplusplus) +extern "C" { +#endif + int mlk_gamepad_open(struct mlk_gamepad *pad, int idx); @@ -75,6 +75,8 @@ int mlk_gamepad_iter_next(struct mlk_gamepad_iter *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_GAMEPAD_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/image.h --- a/libmlk-core/mlk/core/image.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/image.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,11 +21,11 @@ #include -#include "core.h" - struct mlk_texture; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_image_open(struct mlk_texture *, const char *); @@ -33,6 +33,8 @@ int mlk_image_openmem(struct mlk_texture *, const void *, size_t); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_IMAGE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/maths.h --- a/libmlk-core/mlk/core/maths.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/maths.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,7 +21,9 @@ #include "core.h" -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_maths_is_boxed(int, int, unsigned int, unsigned int, int, int); @@ -29,6 +31,8 @@ float mlk_maths_scale(float, float, float, float, float); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_MATHS_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/music.h --- a/libmlk-core/mlk/core/music.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/music.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,8 +21,6 @@ #include -#include "core.h" - enum mlk_music_flags { MLK_MUSIC_NONE = 0, MLK_MUSIC_LOOP = (1 << 0) @@ -32,7 +30,9 @@ void *handle; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_music_open(struct mlk_music *, const char *); @@ -58,6 +58,8 @@ void mlk_music_finish(struct mlk_music *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_MUSIC_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/painter.h --- a/libmlk-core/mlk/core/painter.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/painter.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,11 +19,22 @@ #ifndef MLK_CORE_PAINTER_H #define MLK_CORE_PAINTER_H -#include "core.h" +#define MLK_PAINTER_BEGIN(tex) \ +do { \ + struct mlk_texture *__current_texture__; \ + \ + __current_texture__ = mlk_painter_get_target(); \ + mlk_painter_set_target((tex)) + +#define MLK_PAINTER_END() \ + mlk_painter_set_target(__current_texture__); \ +} while (0) struct mlk_texture; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif struct mlk_texture * mlk_painter_get_target(void); @@ -55,17 +66,8 @@ void mlk_painter_present(void); -MLK_CORE_END_DECLS - -#define MLK_PAINTER_BEGIN(tex) \ -do { \ - struct mlk_texture *__current_texture__; \ - \ - __current_texture__ = mlk_painter_get_target(); \ - mlk_painter_set_target((tex)) - -#define MLK_PAINTER_END() \ - mlk_painter_set_target(__current_texture__); \ -} while (0) +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_PAINTER_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/panic.h --- a/libmlk-core/mlk/core/panic.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/panic.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,13 +21,13 @@ #include -#include "core.h" - #define PANIC_LINE_MAX (256) extern void (*mlk_panic_handler)(const char *); -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void mlk_panicf(const char *, ...); @@ -38,6 +38,8 @@ void mlk_panic(int err); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_PANIC_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/sound.h --- a/libmlk-core/mlk/core/sound.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/sound.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,8 +21,6 @@ #include -#include "core.h" - #define MLK_SOUND_CHANNELS_MAX (256) struct mlk_sound { @@ -30,7 +28,9 @@ int channel; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_sound_open(struct mlk_sound *, const char *); @@ -56,6 +56,8 @@ void mlk_sound_finish(struct mlk_sound *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_SOUND_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/sprite.h --- a/libmlk-core/mlk/core/sprite.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/sprite.h Sat Mar 04 14:23:59 2023 +0100 @@ -85,7 +85,9 @@ unsigned int ncols; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif /** * Initialize the sprite by computing the number of rows and columns. @@ -153,6 +155,8 @@ unsigned int w, unsigned int h); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_SPRITE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/state.h --- a/libmlk-core/mlk/core/state.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/state.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_CORE_STATE_H #define MLK_CORE_STATE_H -#include "core.h" - union mlk_event; struct mlk_state { @@ -35,7 +33,9 @@ void (*finish)(struct mlk_state *); }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void mlk_state_start(struct mlk_state *); @@ -61,6 +61,8 @@ void mlk_state_finish(struct mlk_state *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_STATE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/sys.h --- a/libmlk-core/mlk/core/sys.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/sys.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,13 +21,13 @@ #include -#include "core.h" - enum mlk_sys_dir { MLK_SYS_DIR_SAVE }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_sys_init(const char *, const char *); @@ -41,6 +41,8 @@ void mlk_sys_finish(void); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_SYS_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/texture.h --- a/libmlk-core/mlk/core/texture.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/texture.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,7 +19,6 @@ #ifndef MLK_CORE_TEXTURE_H #define MLK_CORE_TEXTURE_H -#include "core.h" #include "err.h" struct mlk_texture { @@ -36,7 +35,9 @@ MLK_TEXTURE_BLEND_LAST }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_texture_new(struct mlk_texture *, unsigned int, unsigned int); @@ -71,6 +72,8 @@ void mlk_texture_finish(struct mlk_texture *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_TEXTURE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/trace.h --- a/libmlk-core/mlk/core/trace.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/trace.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,13 +21,13 @@ #include -#include "core.h" - #define TRACE_LINE_MAX (1024) extern void (*mlk_trace_handler)(const char *); -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void mlk_tracef(const char *, ...); @@ -35,6 +35,8 @@ void mlk_traceva(const char *, va_list); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_TRACE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/util.h --- a/libmlk-core/mlk/core/util.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/util.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,11 +19,11 @@ #ifndef MLK_CORE_UTIL_H #define MLK_CORE_UTIL_H -#include "core.h" - #define MLK_UTIL_SIZE(x) (sizeof ((x)) / sizeof ((x)[0])) -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void mlk_util_delay(unsigned int); @@ -34,6 +34,8 @@ unsigned int mlk_util_nrand(unsigned int, unsigned int); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_UTIL_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-core/mlk/core/window.h --- a/libmlk-core/mlk/core/window.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-core/mlk/core/window.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_CORE_WINDOW_H #define MLK_CORE_WINDOW_H -#include "core.h" - struct mlk_window { unsigned int w; unsigned int h; @@ -41,7 +39,9 @@ extern struct mlk_window mlk_window; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_window_open(const char *, unsigned int, unsigned int); @@ -52,6 +52,8 @@ void mlk_window_finish(void); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_CORE_WINDOW_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-example/CMakeLists.txt --- a/libmlk-example/CMakeLists.txt Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-example/CMakeLists.txt Sat Mar 04 14:23:59 2023 +0100 @@ -20,16 +20,12 @@ set( SOURCES - ${libmlk-example_SOURCE_DIR}/mlk/example/character-john.c - ${libmlk-example_SOURCE_DIR}/mlk/example/character-john.h ${libmlk-example_SOURCE_DIR}/mlk/example/example.c ${libmlk-example_SOURCE_DIR}/mlk/example/example.h ${libmlk-example_SOURCE_DIR}/mlk/example/glower.c ${libmlk-example_SOURCE_DIR}/mlk/example/glower.h ${libmlk-example_SOURCE_DIR}/mlk/example/registry.c ${libmlk-example_SOURCE_DIR}/mlk/example/registry.h - ${libmlk-example_SOURCE_DIR}/mlk/example/spell-fire.c - ${libmlk-example_SOURCE_DIR}/mlk/example/spell-fire.h ${libmlk-example_SOURCE_DIR}/mlk/example/trace-hud.c ${libmlk-example_SOURCE_DIR}/mlk/example/trace-hud.h ) diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/CMakeLists.txt --- a/libmlk-rpg/CMakeLists.txt Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/CMakeLists.txt Sat Mar 04 14:23:59 2023 +0100 @@ -20,60 +20,6 @@ set( SOURCES - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-bar-default.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-bar-default.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-bar.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-bar.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state-attacking.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state-attacking.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state-blinking.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state-blinking.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state-moving.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state-moving.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state-normal.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state-normal.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity-state.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-entity.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-indicator.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-indicator.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-message.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-message.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-ai.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-ai.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-attacking.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-attacking.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-check.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-check.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-closing.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-closing.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-item.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-item.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-lost.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-lost.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-menu.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-menu.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-opening.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-opening.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-rendering.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-rendering.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-selection.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-selection.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-victory.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state-victory.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle-state.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/battle.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/character.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/character.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/equipment.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/equipment.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/inventory.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/inventory.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/item.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/item.h ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/map-file.c ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/map-file.h ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/map.c @@ -88,12 +34,6 @@ ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/rpg.h ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/save.c ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/save.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/selection.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/selection.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/spell.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/spell.h - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/team.c - ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/team.h ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/tileset-file.c ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/tileset-file.h ${libmlk-rpg_SOURCE_DIR}/mlk/rpg/tileset.c diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/battle-bar-default.h --- a/libmlk-rpg/mlk/rpg/battle-bar-default.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-bar-default.h Sat Mar 04 14:23:59 2023 +0100 @@ -59,8 +59,6 @@ struct mlk_gridmenu grid; }; -MLK_CORE_BEGIN_DECLS - void battle_bar_default_init(struct battle_bar_default *); diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/battle-entity.h --- a/libmlk-rpg/mlk/rpg/battle-entity.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-entity.h Sat Mar 04 14:23:59 2023 +0100 @@ -35,8 +35,6 @@ struct battle_entity_state *state; }; -MLK_CORE_BEGIN_DECLS - void battle_entity_init(struct battle_entity *); diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/character.h --- a/libmlk-rpg/mlk/rpg/character.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/character.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_RPG_CHARACTER_H #define MLK_RPG_CHARACTER_H -#include - #define CHARACTER_SPELL_MAX (64) struct battle; @@ -84,7 +82,9 @@ void (*exec)(struct character *owner, struct battle *bt); }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int character_ok(const struct character *ch); @@ -104,6 +104,8 @@ int character_load(struct character *, struct save *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_CHARACTER_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/equipment.h --- a/libmlk-rpg/mlk/rpg/equipment.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/equipment.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_RPG_EQUIPMENT_H #define MLK_RPG_EQUIPMENT_H -#include - struct character; struct mlk_texture; @@ -53,7 +51,9 @@ void (*equip)(const struct equipment *, struct character *); }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int equipment_ok(const struct equipment *); @@ -61,6 +61,8 @@ void equipment_equip(const struct equipment *, struct character *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_EQUIPMENT_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/inventory.h --- a/libmlk-rpg/mlk/rpg/inventory.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/inventory.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_RPG_INVENTORY_H #define MLK_RPG_INVENTORY_H -#include - #define INVENTORY_ITEM_MAX (512) struct item; @@ -34,7 +32,9 @@ struct inventory_slot items[INVENTORY_ITEM_MAX]; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int inventory_add(struct inventory *, const struct item *, unsigned int); @@ -42,6 +42,8 @@ void inventory_consume(struct inventory *, const struct item *, unsigned int); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_INVENTORY_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/item.h --- a/libmlk-rpg/mlk/rpg/item.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/item.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_RPG_ITEM_H #define MLK_RPG_ITEM_H -#include - struct battle; struct character; struct mlk_texture; @@ -38,7 +36,9 @@ struct character *); }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void item_exec_menu(const struct item *, struct character *); @@ -49,6 +49,8 @@ struct character *, struct character *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_ITEM_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/map-file.h --- a/libmlk-rpg/mlk/rpg/map-file.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/map-file.h Sat Mar 04 14:23:59 2023 +0100 @@ -20,7 +20,6 @@ #define MLK_RPG_MAP_FILE_H #include -#include #include #include @@ -40,7 +39,9 @@ struct mlk_alloc_pool blocks; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int map_file_open(struct map_file *file, struct map *map, const char *path); @@ -48,6 +49,8 @@ void map_file_finish(struct map_file *file); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_MAP_FILE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/map.h --- a/libmlk-rpg/mlk/rpg/map.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/map.h Sat Mar 04 14:23:59 2023 +0100 @@ -23,7 +23,6 @@ #include #include -#include #include "walksprite.h" @@ -98,7 +97,9 @@ struct map_layer layers[MAP_LAYER_TYPE_NUM]; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int map_init(struct map *map); @@ -115,6 +116,8 @@ void map_finish(struct map *map); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_MAP_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/message.h --- a/libmlk-rpg/mlk/rpg/message.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/message.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,7 +21,6 @@ #include -#include #include struct mlk_font; @@ -64,7 +63,9 @@ double scale; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void message_start(struct message *msg); @@ -84,6 +85,8 @@ void message_hide(struct message *msg); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_MESSAGE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/property.h --- a/libmlk-rpg/mlk/rpg/property.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/property.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_RPG_PROPERTY_H #define MLK_RPG_PROPERTY_H -#include - #define PROPERTY_KEY_MAX (64) #define PROPERTY_VALUE_MAX (1024) @@ -31,7 +29,9 @@ char value[PROPERTY_VALUE_MAX + 1]; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int property_save(const struct property *, struct save *); @@ -42,6 +42,8 @@ int property_remove(struct property *, struct save *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_PROPERTY_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/quest.h --- a/libmlk-rpg/mlk/rpg/quest.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/quest.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,8 +21,6 @@ #include -#include - struct save; struct quest_step { @@ -38,7 +36,9 @@ size_t stepsz; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int quest_save(struct quest *, struct save *); @@ -46,6 +46,8 @@ int quest_load(struct quest *, struct save *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_QUEST_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/rpg.h --- a/libmlk-rpg/mlk/rpg/rpg.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/rpg.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,9 +19,9 @@ #ifndef MLK_RPG_RPG_H #define MLK_RPG_RPG_H -#include - -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int rpg_init(void); @@ -29,6 +29,8 @@ void rpg_finish(void); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/save.h --- a/libmlk-rpg/mlk/rpg/save.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/save.h Sat Mar 04 14:23:59 2023 +0100 @@ -45,7 +45,9 @@ SAVE_STMT_ERROR }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int save_open(struct save *, unsigned int, enum save_mode); @@ -82,6 +84,8 @@ void save_tx_commit(struct save *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_SAVE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/selection.h --- a/libmlk-rpg/mlk/rpg/selection.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/selection.h Sat Mar 04 14:23:59 2023 +0100 @@ -47,7 +47,9 @@ unsigned int index_side; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void selection_first(struct selection *, const struct battle *); diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/tileset-file.h --- a/libmlk-rpg/mlk/rpg/tileset-file.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/tileset-file.h Sat Mar 04 14:23:59 2023 +0100 @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -36,7 +35,9 @@ struct mlk_sprite sprite; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int tileset_file_open(struct tileset_file *, struct tileset *, const char *); @@ -44,6 +45,8 @@ void tileset_file_finish(struct tileset_file *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_TILESET_FILE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/tileset.h --- a/libmlk-rpg/mlk/rpg/tileset.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/tileset.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,8 +21,6 @@ #include -#include - struct mlk_sprite; struct tileset_tiledef { @@ -46,7 +44,9 @@ struct mlk_sprite *sprite; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int tileset_ok(const struct tileset *); @@ -60,6 +60,8 @@ void tileset_draw(const struct tileset *, unsigned int, unsigned int, int, int); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_TILESET_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-rpg/mlk/rpg/walksprite.h --- a/libmlk-rpg/mlk/rpg/walksprite.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/walksprite.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_RPG_WALKSPRITE_H #define MLK_RPG_WALKSPRITE_H -#include - struct mlk_sprite; /** @@ -60,7 +58,9 @@ unsigned int elapsed; }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void walksprite_init(struct walksprite *, struct mlk_sprite *, unsigned int); @@ -74,6 +74,8 @@ void walksprite_draw(const struct walksprite *, unsigned int, int, int); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_RPG_WALKSPRITE_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/align.h --- a/libmlk-ui/mlk/ui/align.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/align.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_UI_ALIGN_H #define MLK_UI_ALIGN_H -#include - enum mlk_align { MLK_ALIGN_NONE, MLK_ALIGN_CENTER, @@ -34,7 +32,9 @@ MLK_ALIGN_LEFT }; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void mlk_align(enum mlk_align, @@ -47,6 +47,8 @@ unsigned int, unsigned int); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_UI_ALIGN_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/button.h --- a/libmlk-ui/mlk/ui/button.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/button.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_UI_BUTTON_H #define MLK_UI_BUTTON_H -#include - union mlk_event; struct mlk_button; @@ -53,7 +51,9 @@ extern struct mlk_button_style mlk_button_style; extern struct mlk_button_delegate mlk_button_delegate; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_button_ok(const struct mlk_button *); @@ -67,6 +67,8 @@ void mlk_button_draw(const struct mlk_button *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_UI_BUTTON_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/checkbox.h --- a/libmlk-ui/mlk/ui/checkbox.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/checkbox.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_UI_CHECKBOX_H #define MLK_UI_CHECKBOX_H -#include - union mlk_event; struct mlk_checkbox; @@ -49,7 +47,9 @@ extern struct mlk_checkbox_style mlk_checkbox_style; extern struct mlk_checkbox_delegate mlk_checkbox_delegate; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_checkbox_ok(const struct mlk_checkbox *cb); @@ -63,6 +63,8 @@ void mlk_checkbox_draw(const struct mlk_checkbox *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_UI_CHECKBOX_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/debug.c --- a/libmlk-ui/mlk/ui/debug.c Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/debug.c Sat Mar 04 14:23:59 2023 +0100 @@ -19,6 +19,7 @@ #include #include +#include #include #include "debug.h" diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/debug.h --- a/libmlk-ui/mlk/ui/debug.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/debug.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,9 +21,6 @@ #include -#include -#include - #define MLK_DEBUG_LINE_MAX 256 struct mlk_theme; @@ -36,9 +33,11 @@ unsigned int count; }; -MLK_CORE_BEGIN_DECLS +extern struct mlk_debug_options mlk_debug_options; -extern struct mlk_debug_options mlk_debug_options; +#if defined(__cplusplus) +extern "C" { +#endif void mlk_debugf(struct mlk_debug_report *, const char *, ...); @@ -46,6 +45,8 @@ void mlk_debugva(struct mlk_debug_report *, const char *, va_list); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_UI_DEBUG_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/frame.h --- a/libmlk-ui/mlk/ui/frame.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/frame.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_UI_FRAME_H #define MLK_UI_FRAME_H -#include - struct mlk_frame; struct mlk_frame_style { @@ -45,7 +43,9 @@ extern struct mlk_frame_style mlk_frame_style; extern struct mlk_frame_delegate mlk_frame_delegate; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_frame_ok(const struct mlk_frame *frame); @@ -56,6 +56,8 @@ void mlk_frame_draw(const struct mlk_frame *frame); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_UI_FRAME_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/gridmenu.h --- a/libmlk-ui/mlk/ui/gridmenu.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/gridmenu.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,8 +21,6 @@ #include -#include - #include "label.h" union mlk_event; @@ -65,7 +63,9 @@ extern struct mlk_gridmenu_style mlk_gridmenu_style; extern struct mlk_gridmenu_delegate mlk_gridmenu_delegate; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_gridmenu_ok(const struct mlk_gridmenu *); @@ -82,6 +82,8 @@ void mlk_gridmenu_draw(const struct mlk_gridmenu *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_UI_GRIDMENU_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/label.h --- a/libmlk-ui/mlk/ui/label.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/label.h Sat Mar 04 14:23:59 2023 +0100 @@ -19,8 +19,6 @@ #ifndef MLK_UI_LABEL_H #define MLK_UI_LABEL_H -#include - struct mlk_font; struct mlk_label; @@ -46,7 +44,9 @@ extern struct mlk_label_style mlk_label_style; extern struct mlk_label_delegate mlk_label_delegate; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif int mlk_label_ok(const struct mlk_label *); @@ -60,6 +60,8 @@ void mlk_label_draw(const struct mlk_label *); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_UI_LABEL_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/notify.h --- a/libmlk-ui/mlk/ui/notify.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/notify.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,8 +21,6 @@ #include -#include - struct mlk_font; struct mlk_texture; @@ -54,7 +52,9 @@ extern struct mlk_notify_style mlk_notify_style; extern struct mlk_notify_delegate mlk_notify_delegate; -MLK_CORE_BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif void mlk_notify(const struct mlk_texture *, const char *, const char *); @@ -65,6 +65,8 @@ void mlk_notify_draw(void); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /*! MLK_UI_NOTIFY_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-ui/mlk/ui/ui.h --- a/libmlk-ui/mlk/ui/ui.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-ui/mlk/ui/ui.h Sat Mar 04 14:23:59 2023 +0100 @@ -21,8 +21,6 @@ #include -MLK_CORE_BEGIN_DECLS - /* TODO: make this a global variable to allow modification of default theme. */ /* https://lospec.com/palette-list/duel */ #define MLK_UI_COLOR_TEXT 0x222323ff @@ -42,6 +40,10 @@ extern struct mlk_font *mlk_ui_fonts[MLK_UI_FONT_LAST]; +#if defined(__cplusplus) +extern "C" { +#endif + int mlk_ui_init(void); @@ -59,6 +61,8 @@ void mlk_ui_finish(void); -MLK_CORE_END_DECLS +#if defined(__cplusplus) +} +#endif #endif /* !MLK_UI_UI_H */ diff -r 6af0524913b3 -r 6e8f6640e05b libmlk-util/mlk/util/util.h --- a/libmlk-util/mlk/util/util.h Sat Mar 04 11:23:10 2023 +0100 +++ b/libmlk-util/mlk/util/util.h Sat Mar 04 14:23:59 2023 +0100 @@ -1,5 +1,5 @@ /* - * util.h -- miscellaneous utilities + * util.h -- miscellaneous utilities and portability * * Copyright (c) 2020-2023 David Demelier * @@ -19,6 +19,11 @@ #ifndef MLK_PORT_H #define MLK_PORT_H +/** + * \file mlk/util/util.h + * \brief Miscellaneous utilities and portability + */ + #include #include @@ -72,18 +77,42 @@ # define MLK_HAS_FMEMOPEN #endif -size_t -mlk_util_strlcpy(char *, const char *, size_t); +#if defined(__cplusplus) +extern "C" { +#endif +/** + * Compatibility version of OpenBSD [strlcpy]. + * + * [strlcpy]: http://man.openbsd.org/strlcpy + */ size_t -mlk_util_strlcat(char *, const char *, size_t); +mlk_util_strlcpy(char *dst, const char *src, size_t dstsz); + +/** + * Compatibility version of OpenBSD [strlcat]. + * + * [strlcat]: http://man.openbsd.org/strlcat + */ +size_t +mlk_util_strlcat(char *dst, const char *src, size_t dstsz); FILE * mlk_util_fmemopen(void *, size_t, const char *); +/** + * Portable version of POSIX [basename]. + * + * [basename]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/basename.html + */ char * mlk_util_basename(char *); +/** + * Portable version of POSIX [dirname]. + * + * [dirname]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/dirname.html + */ char * mlk_util_dirname(char *); @@ -92,7 +121,23 @@ extern int mlk_util_optopt; extern char *mlk_util_optarg; +/** + * Portable version of POSIX [getopt]. + * + * All variables that the standard getopt uses are prefixed with `mlk_util_`. + * + * - optarg -> mlk_util_optarg + * - opterr -> mlk_util_opterr + * - optind -> mlk_util_optind + * - optopt -> mlk_util_optopt + * + * [getopt]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html + */ int -mlk_util_getopt(int, char **, const char *); +mlk_util_getopt(int argc, char **argv, const char *optstring); + +#if defined(__cplusplus) +} +#endif #endif /* !MLK_PORT_H */ diff -r 6af0524913b3 -r 6e8f6640e05b tests/CMakeLists.txt --- a/tests/CMakeLists.txt Sat Mar 04 11:23:10 2023 +0100 +++ b/tests/CMakeLists.txt Sat Mar 04 14:23:59 2023 +0100 @@ -23,7 +23,6 @@ action action-script alloc - character color drawable map