25 #ifndef _UCOMMON_CONFIG_H_
29 #ifndef _UCOMMON_CPR_H_
30 #define _UCOMMON_CPR_H_
35 __EXPORT
int cpr_setenv(
const char *s,
const char *v,
int p);
37 inline int setenv(
const char *s,
const char *v,
int overwrite)
38 {
return cpr_setenv(s, v, overwrite);}
52 extern "C" __EXPORT
void *cpr_newp(
void **handle,
size_t size);
54 extern "C" __EXPORT
void cpr_freep(
void **handle);
62 extern "C" __EXPORT
void *
cpr_memalloc(
size_t size) __MALLOC;
73 extern "C" __EXPORT
void *
cpr_memassign(
size_t size, caddr_t address,
size_t known) __MALLOC;
81 extern "C" __EXPORT
void cpr_memswap(
void *mem1,
void *mem2,
size_t size);
83 #ifdef UCOMMON_SYSRUNTIME
89 __EXPORT
void *
operator new(
size_t size);
96 __EXPORT
void *
operator new[](
size_t size);
99 #ifdef UCOMMON_SYSRUNTIME
108 __EXPORT
void *
operator new[](
size_t size,
void *address);
119 __EXPORT
void *
operator new[](
size_t size,
void *address,
size_t known);
122 #ifdef UCOMMON_SYSRUNTIME
127 #if __cplusplus <= 199711L
128 __EXPORT
void operator delete(
void *object);
130 __EXPORT
void operator delete(
void *object) noexcept (
true);
137 #if __cplusplus <= 199711L
138 __EXPORT
void operator delete[](
void *array);
140 __EXPORT
void operator delete[](
void *array) noexcept(
true);
144 extern "C" __EXPORT
void __cxa_pure_virtual(
void);
149 __EXPORT uint16_t lsb_getshort(uint8_t *b);
150 __EXPORT uint32_t lsb_getlong(uint8_t *b);
151 __EXPORT uint16_t msb_getshort(uint8_t *b);
152 __EXPORT uint32_t msb_getlong(uint8_t *b);
154 __EXPORT
void lsb_setshort(uint8_t *b, uint16_t v);
155 __EXPORT
void lsb_setlong(uint8_t *b, uint32_t v);
156 __EXPORT
void msb_setshort(uint8_t *b, uint16_t v);
157 __EXPORT
void msb_setlong(uint8_t *b, uint32_t v);
160 template <
typename T>
161 T *newp(T **handle) {
162 return (T*)cpr_newp(handle,
sizeof(T));
165 template <
typename T>
166 void freep(T **handle) {
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_memalloc(size_t size)
Portable memory allocation helper function.
Various miscellaneous platform specific headers and defines.
void cpr_runtime_error(const char *text)
Function to handle runtime errors.