From c31ea476a685893f5fc22f3f84d579ecd974343d Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Tue, 23 Jan 2024 18:27:24 +0100 Subject: [PATCH] added c++ support to headers --- include/chat/config.h | 9 +++++++++ include/chat/flags.h | 8 ++++++++ include/chat/misc.h | 8 ++++++++ include/chat/parser.h | 8 ++++++++ include/decrypter.h | 8 ++++++++ include/encrypter.h | 8 ++++++++ include/flags.h | 8 ++++++++ include/llist.h | 8 ++++++++ include/logger/flags.h | 8 ++++++++ include/logger/logger.h | 8 ++++++++ include/logger/utils.h | 8 ++++++++ include/memory.h | 8 ++++++++ include/misc.h | 8 ++++++++ include/why2.h | 8 ++++++++ 14 files changed, 113 insertions(+) diff --git a/include/chat/config.h b/include/chat/config.h index 1df6199..8436030 100644 --- a/include/chat/config.h +++ b/include/chat/config.h @@ -19,6 +19,10 @@ along with this program. If not, see . #ifndef WHY2_CHAT_CONFIG_H #define WHY2_CHAT_CONFIG_H +#ifdef __cplusplus +extern "C" { +#endif + //MACROS #define WHY2_CHAT_CODE_ACCEPT_MESSAGES "code_000" #define WHY2_CHAT_CODE_PICK_USERNAME "code_001" @@ -36,4 +40,9 @@ along with this program. If not, see . void why2_chat_init_server_config(void); //CHECK IF SERVER CONFIG EXISTS, CREATE IT void why2_chat_init_client_config(void); //Dementia is a term used to describe a group of symptoms affecting memory, thinking and social abilities. In people who have dementia, the symptoms interfere with their daily lives. Dementia isn't one specific disease. Several diseases can cause dementia. ... + +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/chat/flags.h b/include/chat/flags.h index 58c2cc6..363be5b 100644 --- a/include/chat/flags.h +++ b/include/chat/flags.h @@ -19,6 +19,10 @@ along with this program. If not, see . #ifndef WHY2_CHAT_COMMON_H #define WHY2_CHAT_COMMON_H +#ifdef __cplusplus +extern "C" { +#endif + //MACROS #define WHY2_SA struct sockaddr #define WHY2_SERVER_PORT 1204 //PORT @@ -31,4 +35,8 @@ along with this program. If not, see . #define WHY2_INVALID_POINTER (void*) 0xffffffffffffffff +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/chat/misc.h b/include/chat/misc.h index 8d673cd..2a69f59 100644 --- a/include/chat/misc.h +++ b/include/chat/misc.h @@ -19,6 +19,10 @@ along with this program. If not, see . #ifndef WHY2_CHAT_MISC_H #define WHY2_CHAT_MISC_H +#ifdef __cplusplus +extern "C" { +#endif + #include //TODO: fuck this void why2_send_socket(char *text, char *username, int socket); //send socket.... wtf did you expect @@ -30,4 +34,8 @@ void why2_clean_threads(void); //CLOSE EVERY RUNNING MESSAGE THREAD void *why2_listen_server(void *socket); //LISTEN FOR OTHER's USERS MESSAGES void *why2_getline_thread(WHY2_UNUSED void* arg); //START getline IN SEPARATE THREAD +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/chat/parser.h b/include/chat/parser.h index cd718df..cd90b25 100644 --- a/include/chat/parser.h +++ b/include/chat/parser.h @@ -19,6 +19,14 @@ along with this program. If not, see . #ifndef WHY2_CHAT_PARSER_H #define WHY2_CHAT_PARSER_H +#ifdef __cplusplus +extern "C" { +#endif + char *why2_yml_read(char *path, char *key); //READ key FROM YAML FILE path, RETURNS IT +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/decrypter.h b/include/decrypter.h index c4df689..df6534a 100644 --- a/include/decrypter.h +++ b/include/decrypter.h @@ -19,8 +19,16 @@ along with this program. If not, see . #ifndef WHY2_DECRYPTER_H #define WHY2_DECRYPTER_H +#ifdef __cplusplus +extern "C" { +#endif + #include why2_output_flags why2_decrypt_text(char *text, char *keyNew); //TEXT from WILL BE DECRYPTED WITH KEY AND RETURNED +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/encrypter.h b/include/encrypter.h index 7f86fe7..378ea48 100644 --- a/include/encrypter.h +++ b/include/encrypter.h @@ -19,8 +19,16 @@ along with this program. If not, see . #ifndef WHY2_ENCRYPTER_H #define WHY2_ENCRYPTER_H +#ifdef __cplusplus +extern "C" { +#endif + #include why2_output_flags why2_encrypt_text(char *text, char *keyNew); //TEXT from WILL BE ENCRYPTED WITH KEY AND RETURNED +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/flags.h b/include/flags.h index d7af598..49e875f 100644 --- a/include/flags.h +++ b/include/flags.h @@ -19,6 +19,10 @@ along with this program. If not, see . #ifndef WHY2_FLAGS_H #define WHY2_FLAGS_H +#ifdef __cplusplus +extern "C" { +#endif + //CONSTS enum WHY2_EXIT_CODES //exit codes you fucking idiot { @@ -90,4 +94,8 @@ void why2_set_encryption_operation(why2_encryption_operation_cb newEncryptionOpe void why2_set_memory_identifier(char *new_memory_identifier); void why2_reset_memory_identifier(void); //hmmm, what could reset mean.... huh +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/llist.h b/include/llist.h index 9e6b721..ab7ca2a 100644 --- a/include/llist.h +++ b/include/llist.h @@ -19,6 +19,10 @@ along with this program. If not, see . #ifndef WHY2_LLIST_H #define WHY2_LLIST_H +#ifdef __cplusplus +extern "C" { +#endif + //MACROS #define WHY2_LIST_EMPTY { NULL } @@ -40,4 +44,8 @@ void why2_list_remove(why2_list_t *list, why2_node_t *node); //REMOVE ELEMENT void why2_list_remove_back(why2_list_t *list); //REMOVE LAST ELEMENT why2_node_t *why2_list_find(why2_list_t *list, void *value); //FIND ELEMENT IN LIST +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/logger/flags.h b/include/logger/flags.h index 4a4f472..6f5279a 100644 --- a/include/logger/flags.h +++ b/include/logger/flags.h @@ -19,6 +19,10 @@ along with this program. If not, see . #ifndef WHY2_LOGGER_FLAGS_H #define WHY2_LOGGER_FLAGS_H +#ifdef __cplusplus +extern "C" { +#endif + //CONSTS enum WHY2_LOGGER_EXIT_CODES //exit codes you fucking idiot (2#) { @@ -72,4 +76,8 @@ why2_log_flags why2_get_log_flags(void); //SETTERS void why2_set_log_flags(why2_log_flags why2_log_flagsNew); +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/logger/logger.h b/include/logger/logger.h index 2c8144e..3db13b0 100644 --- a/include/logger/logger.h +++ b/include/logger/logger.h @@ -19,9 +19,17 @@ along with this program. If not, see . #ifndef WHY2_LOGGER_LOGGER_H #define WHY2_LOGGER_LOGGER_H +#ifdef __cplusplus +extern "C" { +#endif + #include why2_log_file why2_init_logger(char *directoryPath); //CREATES LOGGING FILE IN directoryPath void why2_write_log(int loggerFile, char *logMessage); //WRITES logMessage TO loggerFile +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/logger/utils.h b/include/logger/utils.h index 6137f76..091724c 100644 --- a/include/logger/utils.h +++ b/include/logger/utils.h @@ -19,6 +19,10 @@ along with this program. If not, see . #ifndef WHY2_LOGGER_UTILS_C #define WHY2_LOGGER_UTILS_C +#ifdef __cplusplus +extern "C" { +#endif + #include void why2_deallocate_logger(why2_log_file logger); //USE THIS IF YOU WANT TO DEALLOCATE FILE POINTER RETURNED BY logger'S why2_init_logger @@ -27,4 +31,8 @@ why2_decrypted_output why2_decrypt_logger(why2_log_file logger); //PASS logger A why2_log_file why2_empty_log_file(); //RETURN EMTPY why2_log_file WHAT THE FUCK DID YOU EXPECT why2_decrypted_output why2_empty_decrypted_output(); //NO! +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/memory.h b/include/memory.h index 8a1e34e..af2fd0b 100644 --- a/include/memory.h +++ b/include/memory.h @@ -1,6 +1,10 @@ #ifndef WHY2_MEMORY_H #define WHY2_MEMORY_H +#ifdef __cplusplus +extern "C" { +#endif + void *why2_malloc(unsigned long size); void *why2_calloc(unsigned long element, unsigned long size); void *why2_realloc(void *pointer, unsigned long size); @@ -15,4 +19,8 @@ void why2_deallocate(void *pointer); void why2_clean_memory(char *identifier); //identifier SPECIFIES WHICH NODES TO DEALLOCATE | THIS IS BASICALLY GARBAGE COLLECTOR | PASS why2_get_default_memory_identifier() FOR DEALLOCATING EVERYTHING +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/include/misc.h b/include/misc.h index 3b07a8a..bbbd669 100644 --- a/include/misc.h +++ b/include/misc.h @@ -19,6 +19,10 @@ along with this program. If not, see . #ifndef WHY2_MISC_H #define WHY2_MISC_H +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -36,4 +40,8 @@ unsigned long why2_compare_time_micro(struct timeval startTime, struct timeval f void why2_die(char *exit_message); //PRINTS exit_message ERROR AND EXITS WITH CODE 1 char *why2_replace(char *string, char *old, char *new); //REPLACES old IN string WITH new +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/why2.h b/include/why2.h index 054b41e..c8c67bc 100644 --- a/include/why2.h +++ b/include/why2.h @@ -25,6 +25,10 @@ along with this program. If not, see . #ifndef WHY2_WHY2_H #define WHY2_WHY2_H +#ifdef __cplusplus +extern "C" { +#endif + //CORE #include #include @@ -43,4 +47,8 @@ along with this program. If not, see . #include #include +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file