added c++ support to headers

This commit is contained in:
Václav Šmejkal 2024-01-23 18:27:24 +01:00
parent ddbe899071
commit c31ea476a6
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
14 changed files with 113 additions and 0 deletions

View File

@ -19,6 +19,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#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 <https://www.gnu.org/licenses/>.
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

View File

@ -19,6 +19,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#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 <https://www.gnu.org/licenses/>.
#define WHY2_INVALID_POINTER (void*) 0xffffffffffffffff
#ifdef __cplusplus
}
#endif
#endif

View File

@ -19,6 +19,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef WHY2_CHAT_MISC_H
#define WHY2_CHAT_MISC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <why2/flags.h> //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

View File

@ -19,6 +19,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#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

View File

@ -19,8 +19,16 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef WHY2_DECRYPTER_H
#define WHY2_DECRYPTER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <why2/flags.h>
why2_output_flags why2_decrypt_text(char *text, char *keyNew); //TEXT from WILL BE DECRYPTED WITH KEY AND RETURNED
#ifdef __cplusplus
}
#endif
#endif

View File

@ -19,8 +19,16 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef WHY2_ENCRYPTER_H
#define WHY2_ENCRYPTER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <why2/flags.h>
why2_output_flags why2_encrypt_text(char *text, char *keyNew); //TEXT from WILL BE ENCRYPTED WITH KEY AND RETURNED
#ifdef __cplusplus
}
#endif
#endif

View File

@ -19,6 +19,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#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

View File

@ -19,6 +19,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#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

View File

@ -19,6 +19,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#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

View File

@ -19,9 +19,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef WHY2_LOGGER_LOGGER_H
#define WHY2_LOGGER_LOGGER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <why2/logger/flags.h>
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

View File

@ -19,6 +19,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef WHY2_LOGGER_UTILS_C
#define WHY2_LOGGER_UTILS_C
#ifdef __cplusplus
extern "C" {
#endif
#include <why2/logger/flags.h>
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

View File

@ -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

View File

@ -19,6 +19,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef WHY2_MISC_H
#define WHY2_MISC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/time.h>
#include <why2/flags.h>
@ -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

View File

@ -25,6 +25,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef WHY2_WHY2_H
#define WHY2_WHY2_H
#ifdef __cplusplus
extern "C" {
#endif
//CORE
#include <why2/decrypter.h>
#include <why2/encrypter.h>
@ -43,4 +47,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <why2/chat/flags.h>
#include <why2/chat/misc.h>
#ifdef __cplusplus
}
#endif
#endif