[109] | 1 | #ifndef _NONSTD_H_ |
---|
| 2 | #define _NONSTD_H_ |
---|
| 3 | |
---|
| 4 | #define SAFEDELETE(p) {if (p) {delete p; p=NULL;}} |
---|
| 5 | #define SAFEDELETEARRAY(p) {if (p) {delete[] p; p=NULL;}} |
---|
| 6 | |
---|
| 7 | #define roundToInt(x) ((int)(floor((x)+0.5))) |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | #define CPP_STR(s) CPP_XSTR(s) |
---|
| 11 | #define CPP_XSTR(s) #s |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | #define DB(x) //output debug info. If needed, use #define DB(x) x |
---|
| 15 | //#define DB(x) x |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | // ms visual c++ |
---|
| 19 | #ifdef _MSC_VER |
---|
| 20 | #include <stdio.h> //musi byc najpierw ten include zeby robic definy ponizej (albo bedzie '_vsnprintf': attributes inconsistent with previous declaration, stdio.h:358) |
---|
| 21 | #define vsnprintf _vsnprintf |
---|
| 22 | #define snprintf _snprintf |
---|
| 23 | #endif |
---|
| 24 | |
---|
| 25 | #ifdef MOBILE2D |
---|
| 26 | #define strdup _strdup |
---|
| 27 | #endif |
---|
| 28 | |
---|
| 29 | /////////////////////////////////////////////////////// 64-bit int type and other macros |
---|
| 30 | #ifdef _WIN32 |
---|
| 31 | typedef __int64 LONGLONG; |
---|
| 32 | #define PATH_SEPARATOR_CHAR '\\' |
---|
| 33 | #define PATH_SEPARATOR_STRING "\\" |
---|
| 34 | #define FPU_THROWS_EXCEPTIONS |
---|
| 35 | #else |
---|
| 36 | #define LONGLONG long long int |
---|
| 37 | #define PATH_SEPARATOR_CHAR '/' |
---|
| 38 | #define PATH_SEPARATOR_STRING "/" |
---|
| 39 | #endif |
---|
| 40 | |
---|
| 41 | #define FOPEN_READ_BINARY "rb" |
---|
| 42 | // no FOPEN_READ_TEXT |
---|
| 43 | #define FOPEN_WRITE_BINARY "wb" |
---|
| 44 | #define FOPEN_APPEND_BINARY "ab" |
---|
| 45 | #define FOPEN_WRITE_TEXT "wt" |
---|
| 46 | #define FOPEN_APPEND_TEXT "at" |
---|
| 47 | |
---|
| 48 | #ifdef LINUX |
---|
| 49 | #include <strings.h> |
---|
| 50 | #define stricmp(a,b) strcasecmp(a,b) |
---|
| 51 | #define _isnan(a) isnan(a) //do nonstd_math.h? |
---|
| 52 | #ifdef INITIAL_DIR_IS_HOME |
---|
| 53 | #include "cwd.h" |
---|
| 54 | #define GET_APP_HOME getAppHome() |
---|
| 55 | #else |
---|
| 56 | #define GET_APP_HOME "./" |
---|
| 57 | #endif |
---|
| 58 | #ifdef INITIAL_DIR_IS_RES |
---|
| 59 | #include "cwd.h" |
---|
| 60 | #define GET_APP_RESOURCES getAppResources() |
---|
| 61 | #else |
---|
| 62 | #define GET_APP_RESOURCES "./" |
---|
| 63 | #endif |
---|
| 64 | #endif |
---|
| 65 | |
---|
| 66 | #ifdef MACOS |
---|
| 67 | #define stricmp(a,b) strcasecmp(a,b) |
---|
| 68 | #endif |
---|
| 69 | |
---|
| 70 | #ifdef IPHONE |
---|
| 71 | #include <string> |
---|
| 72 | #define _isnan(a) isnan(a) //do nonstd_math.h? |
---|
| 73 | std::string getAppHome(); |
---|
| 74 | std::string getAppResources(); |
---|
| 75 | #define GET_APP_HOME getAppHome() |
---|
| 76 | #define GET_APP_RESOURCES getAppResources() |
---|
| 77 | #endif |
---|
| 78 | |
---|
| 79 | #ifdef SHP |
---|
| 80 | //#define __assert_func(a,b,c,d) 0 //Currently, we are sorry to inform you that assert() is not yet supported. We have considered your request for internal discussion. No ale na szczêcie w³asna (byle by by³a, bo i tak zak³adamy ze assert ktore przeciez dziala tylko w trybie debug nie jest potrzebne na bada) implementacja w "bada-assert.cpp" |
---|
| 81 | #define GET_APP_HOME "/Home/" |
---|
| 82 | #define GET_APP_RESOURCES "/Res/" |
---|
| 83 | #endif |
---|
| 84 | |
---|
| 85 | #ifdef TIZEN |
---|
| 86 | #define GET_APP_HOME "/data/" |
---|
| 87 | #define GET_APP_RESOURCES "/res/" |
---|
| 88 | #endif |
---|
| 89 | |
---|
| 90 | #ifdef __ANDROID__ |
---|
| 91 | #define GET_APP_HOME getAppHome() |
---|
| 92 | #define GET_APP_RESOURCES "./" //w APK trzymamy w katalogu w "assets", bo w "res" nie ma podkatalogow ani odwolywania sie po nazwach |
---|
| 93 | #endif |
---|
| 94 | |
---|
| 95 | #if defined(_WIN32) && !defined(SHP) |
---|
| 96 | #define GET_APP_HOME ".\\" |
---|
| 97 | #define GET_APP_RESOURCES ".\\" |
---|
| 98 | #endif |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | #ifdef MAIN_FRAMSTICKS |
---|
| 103 | #define SCRIPTS_DIR GET_APP_RESOURCES "scripts" //katalogi sa na iphone std::string a gdzie indziej "const char*" i to sie wszedzie kompiluje? |
---|
| 104 | #endif |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | //typedef unsigned char boolean; //niestety nie mozna uzyc 'bool' bo VC w rpcndr.h wlasnie tak definiuje booleana, jako unsigned char |
---|
| 109 | //typedef char byte; //rozne srodowiska c++ definiuja byte jako unsigned char! w javie jest inaczej -> trzeba i tak zmienic w portowanych zrodlach byte na char. |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | #endif |
---|
| 113 | |
---|