26 #ifndef _UCOMMON_CONFIG_H_
30 #ifndef _UCOMMON_CPR_H_
31 #define _UCOMMON_CPR_H_
36 __EXPORT
int cpr_setenv(
const char *s,
const char *v,
int p);
38 inline int setenv(
const char *s,
const char *v,
int overwrite)
40 return cpr_setenv(s, v, overwrite);
55 extern "C" __EXPORT
void *cpr_newp(
void **handle,
size_t size);
57 extern "C" __EXPORT
void cpr_freep(
void **handle);
65 extern "C" __EXPORT
void *
cpr_memalloc(
size_t size) __MALLOC;
76 extern "C" __EXPORT
void *
cpr_memassign(
size_t size, caddr_t address,
size_t known) __MALLOC;
84 extern "C" __EXPORT
void cpr_memswap(
void *mem1,
void *mem2,
size_t size);
86 #ifdef UCOMMON_SYSRUNTIME
92 __EXPORT
void *
operator new(
size_t size);
99 __EXPORT
void *
operator new[](
size_t size);
109 __EXPORT
void *
operator new[](
size_t size,
void *address);
120 __EXPORT
void *
operator new[](
size_t size,
void *address,
size_t known);
126 #if __cplusplus <= 199711L
127 __EXPORT
void operator delete(
void *object);
129 __EXPORT
void operator delete(
void *object) noexcept (
true);
136 #if __cplusplus <= 199711L
137 __EXPORT
void operator delete[](
void *array);
139 __EXPORT
void operator delete[](
void *array) noexcept(
true);
143 extern "C" __EXPORT
void __cxa_pure_virtual(
void);
148 __EXPORT uint16_t lsb_getshort(uint8_t *b);
149 __EXPORT uint32_t lsb_getlong(uint8_t *b);
150 __EXPORT uint16_t msb_getshort(uint8_t *b);
151 __EXPORT uint32_t msb_getlong(uint8_t *b);
153 __EXPORT
void lsb_setshort(uint8_t *b, uint16_t v);
154 __EXPORT
void lsb_setlong(uint8_t *b, uint32_t v);
155 __EXPORT
void msb_setshort(uint8_t *b, uint16_t v);
156 __EXPORT
void msb_setlong(uint8_t *b, uint32_t v);
159 template <
typename T>
160 T *newp(T **handle) {
161 return static_cast<T*
>(cpr_newp(handle,
sizeof(T)));
164 template <
typename T>
165 void freep(T **handle) {
void * cpr_memalloc(size_t size)
Portable memory allocation helper function.
Various miscellaneous platform specific headers and defines.
void cpr_memswap(void *mem1, void *mem2, size_t size)
Portable swap code.
void * cpr_memassign(size_t size, caddr_t address, size_t known)
Portable memory placement helper function.
void cpr_runtime_error(const char *text)
Function to handle runtime errors.