Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4680 right-hear 1
 
2
 */
3
4
 
5
#define __stubs_h__
6
7
 
8
9
 
10
  should be defined in stubs.inl */
11
//inline LispInt StrEqual(const LispChar * ptr1, const LispChar * ptr2);
12
13
 
14
  #define PlatAlloc malloc
15
  #define PlatReAlloc realloc
16
  #define PlatFree free
17
  #define NEW new
18
  #define CHECKPTR(ptr)
19
#else  // NO_GLOBALS -- goes almost to EOF
20
  void *PlatObAlloc(size_t nbytes);
21
  void PlatObFree(void *p);
22
  void *PlatObReAlloc(void *p, size_t nbytes);
23
24
 
25
  #include "debugmem.h"
26
  #define PlatAlloc(nr)        YacasMallocPrivate((size_t)nr,__FILE__,__LINE__)
27
  #define PlatReAlloc(orig,nr) YacasReAllocPrivate(orig,(size_t)nr,__FILE__,__LINE__)
28
  #define PlatFree(orig)       YacasFreePrivate(orig)
29
  #define NEW new (__FILE__,__LINE__)
30
  #define CHECKPTR(ptr) CheckPtr(ptr,__FILE__,__LINE__)
31
#else  // YACAS_DEBUG
32
  #define PlatAlloc(nr)        PlatObAlloc((size_t)nr)
33
  #define PlatReAlloc(orig,nr) PlatObReAlloc(orig,(size_t)nr)
34
  #define PlatFree(orig)       PlatObFree(orig)
35
  #define NEW new
36
  #define CHECKPTR(ptr)
37
#endif  // YACAS_DEBUG
38
39
 
40
inline T * PlatAllocN(LispInt aSize) { return (T*)PlatAlloc(aSize*sizeof(T)); }
41
42
 
43
 
44
45
 
46
 * the global new and delete operators should not be used. So the debug version makes sure
47
 * the executable crashes if one of these are called.
48
 */
49
50
 
51
#define DELETE_THROWER throw ()
52
53
 
54
#if defined(_MSC_VER) && _MSC_VER <= 1310  // getting C4290 warnings?  slowly increase number.
55
#pragma warning( disable : 4290 )  // C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
56
#endif
57
58
 
59
void* operator new[](size_t size) NEW_THROWER;
60
void operator delete(void* object) DELETE_THROWER;
61
void operator delete[](void* object) DELETE_THROWER;
62
63
 
64
65
 
66
67
 
68
69
 
70