Define macros for C linkage
This commit is contained in:
		@@ -17,8 +17,7 @@ internal inline CMDError get_command_output(FILE *fp, CMDOutHandling out_handlin
 | 
			
		||||
                                            char *out_buf, u64 buf_size);
 | 
			
		||||
internal inline CMDError get_output_status(FILE *fp, i32 *status_out);
 | 
			
		||||
 | 
			
		||||
// clang-format off
 | 
			
		||||
CMDResult run_command(CMDOutHandling out_handling, char *out_buf, u64 buf_size, ...) { // clang-format on
 | 
			
		||||
CMDResult run_command(CMDOutHandling out_handling, char *out_buf, u64 buf_size, ...) {
 | 
			
		||||
  va_list args;
 | 
			
		||||
  va_start(args, buf_size);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,11 +7,10 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
BEGIN_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
#define CMD_NO_EXIT(ERR)                                                       \
 | 
			
		||||
  ((CMDResult){.exited = false, .exit_code = EXIT_FAILURE, .error = ERR})
 | 
			
		||||
#define CMD_NO_EXIT(ERR) ((CMDResult){.exited = false, .exit_code = EXIT_FAILURE, .error = ERR})
 | 
			
		||||
#define wapp_shell_commander_execute(HANDLE_OUTPUT, OUT_BUF, BUF_SIZE, ...)    \
 | 
			
		||||
  run_command(HANDLE_OUTPUT, OUT_BUF, BUF_SIZE, __VA_ARGS__, "2>&1", NULL)
 | 
			
		||||
 | 
			
		||||
@@ -41,12 +40,10 @@ struct commander_result {
 | 
			
		||||
#endif // !WAPP_PLATFORM_WINDOWS
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// clang-format off
 | 
			
		||||
CMDResult run_command(CMDOutHandling out_handling, char *out_buf, u64 buf_size, ...);
 | 
			
		||||
// clang-format on
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
END_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
#endif // !COMMANDER_H
 | 
			
		||||
 
 | 
			
		||||
@@ -8,13 +8,13 @@
 | 
			
		||||
#include "terminal_colours.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
BEGIN_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
void print_coloured_text(const char *text, TerminalColour colour);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
END_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
#endif // !WAPP_PLATFORM_POSIX
 | 
			
		||||
 
 | 
			
		||||
@@ -4,14 +4,14 @@
 | 
			
		||||
#include "terminal_colours.h"
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
BEGIN_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
void wapp_shell_termcolour_print_text(const char *text, TerminalColour colour);
 | 
			
		||||
void wapp_shell_termcolour_clear_colour(void);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
END_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
#endif // !TERM_COLOUR_H
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
#define TERMINAL_COLOURS_H
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
BEGIN_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
@@ -28,7 +28,7 @@ typedef enum {
 | 
			
		||||
} TerminalColour;
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
END_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
#endif // !TERMINAL_COLOURS_H
 | 
			
		||||
 
 | 
			
		||||
@@ -12,13 +12,13 @@
 | 
			
		||||
#include <WinCon.h>
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
BEGIN_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
void print_coloured_text(const char *text, TerminalColour colour);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
END_C_LINKAGE
 | 
			
		||||
#endif // __cplusplus
 | 
			
		||||
 | 
			
		||||
#endif // !WAPP_PLATFORM_WINDOWS
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user