$#! | |
_FILE_OFFSET_BITS | |
_GNU_SOURCE | |
_THREAD_SAFE | |
A | |
abortthread_syncrun | |
abs_int32 | |
abs_int64 | |
acceptmallocleak_resourceusage | |
addcolumn_textpos | |
addr_memblock | |
addr_mmfile | |
addr_string | |
addtofreelist_syncqueue | |
alignedsize_mmfile | |
ALLOC_ERR_MM | |
ALLOC_MM | |
ALLOC_PAGECACHE | |
allocatedsize_cstring | |
allocpage_pagecache | |
allocstatic_pagecache | |
ALLOCSTATIC_PAGECACHE | |
api_gcontext | |
appendbyte_wbuffer | |
appendbytes_wbuffer | |
arraysf_IMPLEMENT | |
arraysf_iterator_FREE, arraysf_iterator_t | |
arraysf_node_EMBED, arraysf_node_t | |
arraysf_node_INIT, arraysf_node_t | |
arraystf_IMPLEMENT | |
arraystf_iterator_FREE, arraystf_iterator_t | |
arraystf_node_EMBED, arraystf_node_t | |
arraystf_node_INIT, arraystf_node_t | |
arraystf_node_INIT_CSTR, arraystf_node_t | |
assert | |
assign_blockarray | |
at_blockarray | |
atomicadd_int | |
atomicclear_int | |
atomicread_int | |
atomicset_int | |
atomicsub_int | |
atomicswap_int | |
atomicwrite_int |
Makes file api support of files with size of 2GB * 4GB.
#define _FILE_OFFSET_BITS 64
Makes file api support of files with size of 2GB * 4GB.
#define _GNU_SOURCE
Makes calls to library functions thread safe.
#define _THREAD_SAFE
Implements syncrun_t.abortthread_syncrun.
#define abortthread_syncrun( srun ) do { setstateabort_syncrun(srun) ; return 0 ; } while (0)
Implements resourceusage_t.acceptmallocleak_resourceusage.
#define acceptmallocleak_resourceusage( usage, malloc_leak_in_bytes ) do { (usage)->malloc_acceptleak = (malloc_leak_in_bytes); } while (0)
Implements textpos_t.addcolumn_textpos.
#define addcolumn_textpos( txtpos, increment ) ((txtpos)->column += (increment))
Implements memblock_t.addr_memblock.
#define addr_memblock( mblock ) ((mblock)->addr)
Implements mmfile_t.addr_mmfile.
#define addr_mmfile( mfile ) ((mfile)->addr)
Implements string_t.addr_string.
#define addr_string( str ) ((str)->addr)
Implements syncqueue_t.addtofreelist_syncqueue.
#define addtofreelist_syncqueue( syncqueue, freelist, elem ) do { static_assert( sizeof(*(elem)) >= sizeof(dlist_node_t), "Check that element can hold a dlist_node_t") ; insertfirst_dlist( freelist, (dlist_node_t*)elem) ; } while (0)
Implements mmfile_t.alignedsize_mmfile.
#define alignedsize_mmfile( mfile ) ((size_mmfile(mfile) + (pagesize_vm()-1)) & ~(pagesize_vm()-1))
Allocates a new memory block with error.
#define ALLOC_ERR_MM( errtimer, size, mblock ) ( __extension__ ({ err = process_testerrortimer(errtimer); if (! err) err = ALLOC_MM(size, mblock); err ; }))
Allocates a new memory block.
#define ALLOC_MM( size, mblock ) malloc_mm(mm_maincontext(), size, mblock)
Allocates a single memory page of size pgsize (see pagesize_e) and returns it in page.
#define ALLOC_PAGECACHE( pgsize, page ) (allocpage_pagecache(pagecache_maincontext(), (pgsize), (page)))
Implements cstring_t.allocatedsize.
#define allocatedsize_cstring( cstr ) ((cstr)->allocated_size)
Implements pagecache_t.allocpage_pagecache.
#define allocpage_pagecache( pgcache, pgsize, page ) ((pgcache).iimpl->allocpage((pgcache).object, (pgsize), (page)))
Implements pagecache_t.allocstatic_pagecache.
#define allocstatic_pagecache( pgcache, bytesize, memblock ) ((pgcache).iimpl->allocstatic((pgcache).object, (bytesize), (memblock)))
Allocates static block of memory and returns it in memblock.
#define ALLOCSTATIC_PAGECACHE( bytesize, memblock ) (allocstatic_pagecache(pagecache_maincontext(), (bytesize), (memblock)))
Implements gcontext_t.api_gcontext.
#define api_gcontext( cont, disp, api ) api_eglcontext(gl_gcontext(cont), gl_display(disp), api)
Implements wbuffer_t.appendbyte_wbuffer.
#define appendbyte_wbuffer( wbuf, c ) ( __extension__ ({ int _err = 0 ; wbuffer_t * _wb = (wbuf) ; if ( 0 != sizereserved_wbuffer(_wb) || (0 == (_err = _wb->iimpl-> alloc(_wb->impl, 1, (struct memstream_t*)_wb)))) { *(_wb->next++) = c ; } _err ; }))
Implements arraysf_t.arraysf_IMPLEMENT.
#define arraysf_IMPLEMENT( _fsuffix, object_t, nodename ) typedef arraysf_iterator_t iteratortype##_fsuffix ; typedef object_t * iteratedtype##_fsuffix ; static inline int new##_fsuffix(/*out*/arraysf_t ** array, uint32_t toplevelsize, uint8_t posshift) __attribute__ ((always_inline)) ; static inline int delete##_fsuffix(arraysf_t ** array, struct typeadapt_member_t * nodeadp) __attribute__ ((always_inline)) ; static inline size_t length##_fsuffix(arraysf_t * array) __attribute__ ((always_inline)) ; static inline object_t * at##_fsuffix(const arraysf_t * array, size_t pos) __attribute__ ((always_inline)) ; static inline int insert##_fsuffix(arraysf_t * array, object_t * node, /*out*/object_t ** inserted_node/*0=>not returned*/, struct typeadapt_member_t * nodeadp/*0=>no copy is made*/) __attribute__ ((always_inline)) ; static inline int tryinsert##_fsuffix(arraysf_t * array, object_t * node, /*out;err*/object_t ** inserted_or_existing_node, struct typeadapt_member_t * nodeadp/*0=>no copy is made*/) __attribute__ ((always_inline)) ; static inline int remove##_fsuffix(arraysf_t * array, size_t pos, /*out*/object_t ** removed_node) __attribute__ ((always_inline)) ; static inline int tryremove##_fsuffix(arraysf_t * array, size_t pos, /*out*/object_t ** removed_node) __attribute__ ((always_inline)) ; static inline int initfirst##_fsuffix##iterator(/*out*/arraysf_iterator_t * iter, arraysf_t * array) __attribute__ ((always_inline)) ; static inline int free##_fsuffix##iterator(arraysf_iterator_t * iter) __attribute__ ((always_inline)) ; static inline bool next##_fsuffix##iterator(arraysf_iterator_t * iter, /*out*/object_t ** node) __attribute__ ((always_inline)) ; static inline arraysf_node_t * asnode##_fsuffix(object_t * object) { static_assert(&((object_t*)0)->nodename == (void*)offsetof(object_t, nodename), "correct type") ; return (arraysf_node_t*) ((uintptr_t)object + offsetof(object_t, nodename)) ; } static inline object_t * asobject##_fsuffix(arraysf_node_t * node) { return (object_t *) ((uintptr_t)node - offsetof(object_t, nodename)) ; } static inline object_t * asobjectnull##_fsuffix(arraysf_node_t * node) { return node ? (object_t *) ((uintptr_t)node - offsetof(object_t, nodename)) : 0 ; } static inline int new##_fsuffix(/*out*/arraysf_t ** array, uint32_t toplevelsize, uint8_t posshift) { return new_arraysf(array, toplevelsize, posshift) ; } static inline int delete##_fsuffix(arraysf_t ** array, struct typeadapt_member_t * nodeadp) { return delete_arraysf(array, nodeadp) ; } static inline size_t length##_fsuffix(arraysf_t * array) { return length_arraysf(array) ; } static inline object_t * at##_fsuffix(const arraysf_t * array, size_t pos) { arraysf_node_t * node = at_arraysf(array, pos) ; return asobjectnull##_fsuffix(node) ; } static inline int insert##_fsuffix(arraysf_t * array, object_t * node, /*out*/object_t ** inserted_node/*0=>not returned*/, struct typeadapt_member_t * nodeadp/*0=>no copy is made*/) { int err = insert_arraysf(array, asnode##_fsuffix(node), (struct arraysf_node_t**)inserted_node, nodeadp) ; if (!err && inserted_node) *inserted_node = asobject##_fsuffix(*(struct arraysf_node_t**)inserted_node) ; return err ; } static inline int tryinsert##_fsuffix(arraysf_t * array, object_t * node, /*out;err*/object_t ** inserted_or_existing_node, struct typeadapt_member_t * nodeadp/*0=>no copy is made*/) { int err = tryinsert_arraysf(array, asnode##_fsuffix(node), (struct arraysf_node_t**)inserted_or_existing_node, nodeadp) ; *inserted_or_existing_node = asobjectnull##_fsuffix(*(struct arraysf_node_t**)inserted_or_existing_node) ; return err ; } static inline int remove##_fsuffix(arraysf_t * array, size_t pos, /*out*/object_t ** removed_node) { int err = remove_arraysf(array, pos, (struct arraysf_node_t**)removed_node) ; if (!err) *removed_node = asobject##_fsuffix(*(struct arraysf_node_t**)removed_node) ; return err ; } static inline int tryremove##_fsuffix(arraysf_t * array, size_t pos, /*out*/object_t ** removed_node) { int err = tryremove_arraysf(array, pos, (struct arraysf_node_t**)removed_node) ; if (!err) *removed_node = asobject##_fsuffix(*(struct arraysf_node_t**)removed_node) ; return err ; } static inline int initfirst##_fsuffix##iterator(/*out*/arraysf_iterator_t * iter, arraysf_t * array) { return initfirst_arraysfiterator(iter, array) ; } static inline int free##_fsuffix##iterator(arraysf_iterator_t * iter) { return free_arraysfiterator(iter) ; } static inline bool next##_fsuffix##iterator(arraysf_iterator_t * iter, /*out*/object_t ** node) { bool isNext = next_arraysfiterator(iter, (struct arraysf_node_t**)node) ; if (isNext) *node = asobject##_fsuffix(*(struct arraysf_node_t**)node) ; return isNext ; }
Adapts interface of arraysf_t to object type object_t.
void arraysf_IMPLEMENT( IDNAME _fsuffix, TYPENAME object_t, IDNAME nodename ) ;
Static initializer.
#define arraysf_iterator_FREE { 0, 0, 0 }
Allows to embed members of arraysf_node_t into another structure.
#define arraysf_node_EMBED( name_pos ) size_t name_pos
Static initializer with parameter pos of type size_t.
#define arraysf_node_INIT( pos ) { pos }
Implements arraystf_t.arraystf_IMPLEMENT.
#define arraystf_IMPLEMENT( _fsuffix, object_t, nodename ) typedef arraystf_iterator_t iteratortype##_fsuffix ; typedef object_t * iteratedtype##_fsuffix ; static inline int new##_fsuffix(/*out*/arraystf_t ** array, uint32_t toplevelsize) __attribute__ ((always_inline)) ; static inline int delete##_fsuffix(arraystf_t ** array, struct typeadapt_member_t * nodeadp) __attribute__ ((always_inline)) ; static inline size_t length##_fsuffix(arraystf_t * array) __attribute__ ((always_inline)) ; static inline object_t * at##_fsuffix(const arraystf_t * array, size_t size, const uint8_t keydata[size]) __attribute__ ((always_inline)) ; static inline int insert##_fsuffix(arraystf_t * array, object_t * node, /*out*/object_t ** inserted_node/*0=>copy not returned*/, struct typeadapt_member_t * nodeadp/*0=>no copy is made*/) __attribute__ ((always_inline)) ; static inline int tryinsert##_fsuffix(arraystf_t * array, object_t * node, /*out;err*/object_t ** inserted_or_existing_node, struct typeadapt_member_t * nodeadp/*0=>no copy is made*/) __attribute__ ((always_inline)) ; static inline int remove##_fsuffix(arraystf_t * array, size_t size, const uint8_t keydata[size], /*out*/object_t ** removed_node) __attribute__ ((always_inline)) ; static inline int tryremove##_fsuffix(arraystf_t * array, size_t size, const uint8_t keydata[size], /*out*/object_t ** removed_node) __attribute__ ((always_inline)) ; static inline int initfirst##_fsuffix##iterator(/*out*/arraystf_iterator_t * iter, arraystf_t * array) __attribute__ ((always_inline)) ; static inline int free##_fsuffix##iterator(arraystf_iterator_t * iter) __attribute__ ((always_inline)) ; static inline bool next##_fsuffix##iterator(arraystf_iterator_t * iter, /*out*/object_t ** node) __attribute__ ((always_inline)) ; static inline arraystf_node_t * asnode##_fsuffix(object_t * object) { static_assert(&((object_t*)0)->nodename == (void*)offsetof(object_t, nodename), "correct type") ; return (arraystf_node_t*) ((uintptr_t)object + offsetof(object_t, nodename)) ; } static inline object_t * asobject##_fsuffix(arraystf_node_t * node) { return (object_t *) ((uintptr_t)node - offsetof(object_t, nodename)) ; } static inline object_t * asobjectnull##_fsuffix(arraystf_node_t * node) { return node ? (object_t *) ((uintptr_t)node - offsetof(object_t, nodename)) : 0 ; } static inline int new##_fsuffix(/*out*/arraystf_t ** array, uint32_t toplevelsize) { return new_arraystf(array, toplevelsize) ; } static inline int delete##_fsuffix(arraystf_t ** array, struct typeadapt_member_t * nodeadp) { return delete_arraystf(array, nodeadp) ; } static inline size_t length##_fsuffix(arraystf_t * array) { return length_arraystf(array) ; } static inline object_t * at##_fsuffix(const arraystf_t * array, size_t size, const uint8_t keydata[size]) { arraystf_node_t * node = at_arraystf(array, size, keydata) ; return asobjectnull##_fsuffix(node) ; } static inline int insert##_fsuffix(arraystf_t * array, object_t * node, /*out*/object_t ** inserted_node/*0=>copy not returned*/, struct typeadapt_member_t * nodeadp/*0=>no copy is made*/) { int err = insert_arraystf(array, asnode##_fsuffix(node), (struct arraystf_node_t**)inserted_node, nodeadp) ; if (!err && inserted_node) *inserted_node = asobject##_fsuffix(*(struct arraystf_node_t**)inserted_node) ; return err ; } static inline int tryinsert##_fsuffix(arraystf_t * array, object_t * node, /*out;err*/object_t ** inserted_or_existing_node, struct typeadapt_member_t * nodeadp/*0=>no copy is made*/) { int err = tryinsert_arraystf(array, asnode##_fsuffix(node), (struct arraystf_node_t**)inserted_or_existing_node, nodeadp) ; *inserted_or_existing_node = asobjectnull##_fsuffix(*(struct arraystf_node_t**)inserted_or_existing_node) ; return err ; } static inline int remove##_fsuffix(arraystf_t * array, size_t size, const uint8_t keydata[size], /*out*/object_t ** removed_node) { int err = remove_arraystf(array, size, keydata, (struct arraystf_node_t**)removed_node) ; if (!err) *removed_node = asobject##_fsuffix(*(struct arraystf_node_t**)removed_node) ; return err ; } static inline int tryremove##_fsuffix(arraystf_t * array, size_t size, const uint8_t keydata[size], /*out*/object_t ** removed_node) { int err = tryremove_arraystf(array, size, keydata, (struct arraystf_node_t**)removed_node) ; if (!err) *removed_node = asobject##_fsuffix(*(struct arraystf_node_t**)removed_node) ; return err ; } static inline int initfirst##_fsuffix##iterator(/*out*/arraystf_iterator_t * iter, arraystf_t * array) { return initfirst_arraystfiterator(iter, array) ; } static inline int free##_fsuffix##iterator(arraystf_iterator_t * iter) { return free_arraystfiterator(iter) ; } static inline bool next##_fsuffix##iterator(arraystf_iterator_t * iter, /*out*/object_t ** node) { bool isNext = next_arraystfiterator(iter, (struct arraystf_node_t**)node) ; if (isNext) *node = asobject##_fsuffix(*(struct arraystf_node_t**)node) ; return isNext ; }
Adapts interface of arraystf_t to object type object_t.
void arraystf_IMPLEMENT( IDNAME _fsuffix, TYPENAME object_t, IDNAME nodename ) ;
Static initializer.
#define arraystf_iterator_FREE { 0, 0, 0 }
Allows to embed members of arraystf_node_t into another structure.
#define arraystf_node_EMBED( name_addr, name_size ) const uint8_t * name_addr ; size_t name_size
Static initializer with parameter length in bytes and address of key.
#define arraystf_node_INIT( length, key ) { .addr = key, .size = length }
Static initializer with parameter cstr referencing a “constant string”.
#define arraystf_node_INIT_CSTR( cstr ) { .addr = (const uint8_t*)(cstr), .size = (sizeof(cstr)?sizeof(cstr)-1:0) }
Prints »Assertion failed« and aborts process.
#define assert( expr ) ((expr) ? (void) 0 : assertfail_maincontext(STR(expr), __FILE__, __LINE__, __FUNCTION__))
Implements blockarray_t.assign_blockarray.
#define assign_blockarray( barray, arrayindex, elemaddr ) (assign2_blockarray(barray, arrayindex, true, elemaddr))
Implements blockarray_t.at_blockarray.
#define at_blockarray( barray, arrayindex ) ( __extension__ ({ void * elemaddr = 0 ; assign2_blockarray( (barray), (arrayindex), false, &elemaddr) ; elemaddr ; }))
Implements int_t.atomicadd_int.
#define atomicadd_int( i, increment ) (__sync_fetch_and_add((i), (increment)))
Implements int_t.atomicclear_int.
#define atomicclear_int( flag ) (__sync_lock_release(flag))
Implements int_t.atomicread_int.
#define atomicread_int( i ) (__sync_fetch_and_add((i), 0))
Implements int_t.atomicset_int.
#define atomicset_int( flag ) (__sync_lock_test_and_set(flag, 1))
Implements int_t.atomicsub_int.
#define atomicsub_int( i, decrement ) (__sync_fetch_and_sub((i), (decrement)))
Implements int_t.atomicswap_int.
#define atomicswap_int( i, oldval, newval ) (__sync_val_compare_and_swap(i, oldval, newval))
Implements int_t.atomicwrite_int.
#define atomicwrite_int( i, newval ) ( __extension__ ({ typeof(i) _i = (i) ; typeof(*_i) _new = (newval) ; typeof(*_i) _old = *_i ; typeof(*_i) _old2 ; for (;;) { _old2 = __sync_val_compare_and_swap( _i, _old, _new) ; if (_old2 == _old) break ; _old = _old2 ; } _old ; }))