source: cpp/gdk/nonstd.h @ 89

Last change on this file since 89 was 82, checked in by Maciej Komosinski, 12 years ago

compiles under more platforms and OSes

  • Property svn:eol-style set to native
File size: 2.4 KB
RevLine 
[82]1#ifndef _NONSTD_H_
2#define _NONSTD_H_
[66]3
4#define SAFEDELETE(p) {if (p) {delete p; p=NULL;}}
5#define SAFEDELETEARRAY(p) {if (p) {delete[] p; p=NULL;}}
6
[82]7#define roundToInt(x) ((int)(floor((x)+0.5)))
[66]8
[82]9
10#define CPP_STR(s) CPP_XSTR(s)
11#define CPP_XSTR(s) #s
12
13
[66]14#define DB(x) //output debug info. If needed, use #define DB(x) x
15//#define DB(x) x
16
[82]17
[66]18// ms visual c++
19#ifdef _MSC_VER
[82]20 #include <stdio.h> //musi byc najpierw ten include zeby robic definy ponizej (albo bedzie '_vsnprintf': attributes inconsistent with previous declaration, stdio.h:358)
[66]21 #define vsnprintf _vsnprintf
[82]22 #define snprintf _snprintf
23#endif
[66]24
[82]25#ifdef MOBILE2D
26 #define strdup _strdup
[66]27#endif
28
29/////////////////////////////////////////////////////// 64-bit int type and other macros
[82]30#ifdef _WIN32
[66]31        typedef __int64 LONGLONG;
[82]32        #define PATH_SEPARATOR_CHAR '\\'
33        #define PATH_SEPARATOR_STRING "\\"
[66]34        #define FPU_THROWS_EXCEPTIONS
[68]35        #define FOPEN_READ "rt"
36        #define FOPEN_WRITE "wt"
37        #define FOPEN_APPEND "at"
[66]38#else
39        #define LONGLONG long long int
[82]40        #define PATH_SEPARATOR_CHAR '/'
41        #define PATH_SEPARATOR_STRING "/"
[69]42        #define FOPEN_READ "r"
43        #define FOPEN_WRITE "w"
44        #define FOPEN_APPEND "a"
[66]45#endif
46
47
[82]48
49#ifdef LINUX
50 #include <strings.h>
51 #define stricmp(a,b) strcasecmp(a,b)
52 #define _isnan(a) isnan(a) //do nonstd_math.h?
53 #define GET_APP_HOME "./"
54 #define GET_APP_RESOURCES "./"
[66]55#endif
56
[82]57#ifdef IPHONE
58 #include <string>
59 #define _isnan(a) isnan(a) //do nonstd_math.h?
60 std::string getAppHome(); //w tym pliku deklaracja funkcji nie pasuje...
61 std::string getAppResources();
62 #define GET_APP_HOME getAppHome()
63 #define GET_APP_RESOURCES getAppResources()
64#endif
[66]65
[82]66#ifdef SHP
67 //#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"
68 #define GET_APP_HOME "/Home/"
69 #define GET_APP_RESOURCES "/Res/"
[66]70#endif
71
[82]72#if defined(_WIN32) && !defined(SHP)
73    #define GET_APP_HOME ".\\"
74    #define GET_APP_RESOURCES ".\\"
[66]75#endif
76
[82]77//typedef unsigned char boolean; //niestety nie mozna uzyc 'bool' bo VC w rpcndr.h wlasnie tak definiuje booleana, jako unsigned char
78//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.
79
[66]80#endif
Note: See TracBrowser for help on using the repository browser.