/*************************************************************************** * system.h * * Copyright 2009 - Steffen Pohle * steffen@gulpe.de ****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _SYSTEM_H_ #define _SYSTEM_H_ #include #include #include #include #include #include #include #if !defined(__MINGW32CE__) && !defined(_WIN32_WCE) && !defined(__MINGW32__) #define POINTERALIGNMENT 4 #include #include #if !defined(ANDROID) #include #endif #else #if defined(__MINGW32CE__) || defined(_WIN32_WCE) #define POINTERALIGNMENT 8 #define errno 0 #define strerror(_t) "no strerror support in winCE" #else #define POINTERALIGNMENT 4 #endif #endif #include #include #include #include #if defined(__MINGW32CE__) || defined(_WIN32_WCE) #define DIR_SEP '/' #else #if defined(__MINGW32__) #define DIR_SEP '\\' #else #define DIR_SEP '/' #endif #endif #define SETFLAG(__flag, __opt) (__flag |= __opt) #define DELFLAG(__flag, __opt) (__flag &= (0x0FFFF - __opt)) #define ISFLAG(__flag, __opt) (__flag & __opt) #define ISNOTFLAG(__flag, __opt) (!(__flag & __opt)) struct s_execcall { int used; pid_t pid; }; extern int cmpf (float f1, float f2); extern int cmpd (double d1, double d2); #ifdef ANDROID #include #include #include #include #include #include #include #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "sposmroute", __VA_ARGS__)) #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "sposmroute", __VA_ARGS__)) #define d_printf(...) ((void)__android_log_print(ANDROID_LOG_INFO, "sposmroute", __VA_ARGS__)) #else extern void d_printf (char *fmt,...); #endif extern void d_print_init(); extern void d_print_backtrace (); extern void d_print_stat (); extern void errorexit (int nr); extern int execcall (struct s_execcall *p, char *prg, char **argv); extern int execwait (struct s_execcall *p); extern unsigned long long int getticks (); extern char **get_backtrace (int *cnt); extern char *mempush (void *mem, void *source, int size); extern char *mempop (void *mem, void *dest, int size); extern char *memstrpop (void *mem, void *dest, int *size); #if !defined(ANDROID) extern void memswap (void *mem1, void *mem2, int size); // maximum 32 bytes #endif struct stat *file_exist (char *fn); struct stat *dir_exist (char *fn); extern char* flags2text (int f, char *text); #endif