--- libelwix/inc/elwix.h 2024/10/10 23:53:00 1.24.2.1 +++ libelwix/inc/elwix.h 2025/09/26 15:51:31 1.27.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: elwix.h,v 1.24.2.1 2024/10/10 23:53:00 misho Exp $ +* $Id: elwix.h,v 1.27.2.1 2025/09/26 15:51:31 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004 - 2024 +Copyright 2004 - 2025 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -51,6 +51,7 @@ SUCH DAMAGE. #include #include #include +#include #include #include #include @@ -82,6 +83,7 @@ SUCH DAMAGE. #include #include #include +#include #ifndef STRSIZ @@ -180,9 +182,16 @@ SUCH DAMAGE. #define VACUUM_BETWEEN 2 -extern int __isthreaded; +typedef struct { + E_ATOMIC_ALIGN int value; +} e_atomic_int; +#ifdef __cplusplus +extern "C" { +#endif +extern int __isthreaded; + // elwix_SetProg() Set program memory pool name void elwix_SetProg(const char *csProgName); // elwix_GetProg() Get program memory pool name @@ -259,7 +268,7 @@ extern int elwix_Verbose; #define EVERBS(x) if ((x) <= elwix_Verbose) #define EVERBOSE(x, fmt, ...) do { assert((fmt)); \ if ((x) <= elwix_Verbose) { \ - char __str[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; \ + char __str[BUFSIZ] = { 0 }; \ snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ syslog(LOG_INFO, "Verbose(%d):%s(%d): %s\n", \ (x), __func__, __LINE__, __str); \ @@ -267,7 +276,7 @@ extern int elwix_Verbose; } while (0) #define EVERBOSE2(x, fmt, ...) do { assert((fmt)); \ if ((x) <= elwix_Verbose) { \ - char __str[0x10000] = { [0 ... 0xffff] = 0 }; \ + char __str[0x10000] = { 0 }; \ snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ syslog(LOG_INFO, "Verbose(%d):%s(%d): %s\n", \ (x), __func__, __LINE__, __str); \ @@ -296,7 +305,7 @@ extern int elwix_Debug; syslog(LOG_DEBUG, "I'm in %s(%d)\n", __func__, __LINE__) #define EDEBUG(x, fmt, ...) do { assert((fmt)); \ if ((x) & elwix_Debug) { \ - char __str[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; \ + char __str[BUFSIZ] = { 0 }; \ snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ syslog(LOG_DEBUG, "Debug(%d):%s(%d): %s\n", \ (x), __func__, __LINE__, __str); \ @@ -305,21 +314,21 @@ extern int elwix_Debug; /* Logger macro */ #define ELOGGER(x, fmt, ...) do { assert((fmt)); \ - char __str[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; \ + char __str[BUFSIZ] = { 0 }; \ snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ - syslog((x), "Logger:%s(%d): %s\n", \ + syslog((x), "Log:%s(%d): %s\n", \ __func__, __LINE__, __str); \ } while (0) #define EWARNING(x, fmt, ...) do { assert((fmt)); \ - char __str[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; \ + char __str[BUFSIZ] = { 0 }; \ snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ syslog(LOG_WARNING, "Warning:%s(%d): #%d - %s\n", \ __func__, __LINE__, (x), __str); \ } while (0) /* Error state macros */ #define EERROR(x, fmt, ...) do { assert((fmt)); \ - char __str[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; \ + char __str[BUFSIZ] = { 0 }; \ snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ syslog(LOG_ERR, "Error:%s(%d): #%d - %s\n", \ __func__, __LINE__, (x), __str); \ @@ -340,5 +349,9 @@ extern int elwix_Debug; ait##_GetError()); \ } while (0) + +#ifdef __cplusplus +} +#endif #endif