00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00025 #ifndef _UCOMMON_CONFIG_H_
00026 #include <ucommon/platform.h>
00027 #endif
00028
00029 #ifndef _UCOMMON_CPR_H_
00030 #define _UCOMMON_CPR_H_
00031
00032 #ifdef _MSWINDOWS_
00033
00034 extern "C" {
00035 __EXPORT int cpr_setenv(const char *s, const char *v, int p);
00036
00037 inline int setenv(const char *s, const char *v, int overwrite)
00038 {return cpr_setenv(s, v, overwrite);}
00039 }
00040
00041 #endif
00042
00043
00050 __EXPORT void cpr_runtime_error(const char *text);
00051
00058 extern "C" __EXPORT void *cpr_memalloc(size_t size) __MALLOC;
00059
00069 extern "C" __EXPORT void *cpr_memassign(size_t size, caddr_t address, size_t known) __MALLOC;
00070
00077 extern "C" __EXPORT void cpr_memswap(void *mem1, void *mem2, size_t size);
00078
00079 #ifndef _UCOMMON_EXTENDED_
00080
00085 inline void *operator new(size_t size)
00086 {return cpr_memalloc(size);}
00087
00093 inline void *operator new[](size_t size)
00094 {return cpr_memalloc(size);}
00095 #endif
00096
00097 #ifndef _UCOMMON_EXTENDED_
00098
00106 inline void *operator new[](size_t size, caddr_t address)
00107 {return cpr_memassign(size, address, size);}
00108
00118 inline void *operator new[](size_t size, caddr_t address, size_t known)
00119 {return cpr_memassign(size, address, known);}
00120 #endif
00121
00131 inline void *operator new(size_t size, size_t extra)
00132 {return cpr_memalloc(size + extra);}
00133
00142 inline void *operator new(size_t size, caddr_t address)
00143 {return cpr_memassign(size, address, size);}
00144
00155 inline void *operator new(size_t size, caddr_t address, size_t known)
00156 {return cpr_memassign(size, address, known);}
00157
00158 #ifndef _UCOMMON_EXTENDED_
00159
00163 inline void operator delete(void *object)
00164 {free(object);}
00165
00170 inline void operator delete[](void *array)
00171 {free(array);}
00172
00173 #ifdef __GNUC__
00174 extern "C" __EXPORT void __cxa_pure_virtual(void);
00175 #endif
00176 #endif
00177
00178 extern "C" {
00179 __EXPORT uint16_t lsb_getshort(uint8_t *b);
00180 __EXPORT uint32_t lsb_getlong(uint8_t *b);
00181 __EXPORT uint16_t msb_getshort(uint8_t *b);
00182 __EXPORT uint32_t msb_getlong(uint8_t *b);
00183
00184 __EXPORT void lsb_setshort(uint8_t *b, uint16_t v);
00185 __EXPORT void lsb_setlong(uint8_t *b, uint32_t v);
00186 __EXPORT void msb_setshort(uint8_t *b, uint16_t v);
00187 __EXPORT void msb_setlong(uint8_t *b, uint32_t v);
00188 }
00189
00190 #endif