[mainpage]
[tags]
Data structures and utility functions for C
This library contains various generic data structures and utility functions.
DEDS is used by DEGFX portable graphics library and
DEPUI portable gui library.
(../include/deds/deds.h)
modules:
- alloc
Wrappers for C memory management functions with error checking
- atom
Reference counting atom with delete locking
- bool
Boolean true and false macros
- dllist
Double linked list structure handling macros.
- maxmin
Simple macros for maximum and minimum of two values.
- memtype
Typedefs for memory managment functions.
- rect
Basic rectangle handling
- rectatom
Rectangles with reference counting.
- string
Some simple string allocation and handling functions.
- tree
Tree structure handling macros
- vector
A 100% typesafe generic vector for C.
documented objects:
- # define MXMODULE_ALLOC
Turn on memory tracking
- # define mx_malloc
Replacement for stdlib malloc
- # define mx_realloc
Replacement for stdlib realloc
- # define mx_free
Replacement for stdlib free
- # define MXDEBUG_ALLOCTAG(p)
Tag an allocation (debug)
- # define MXDEBUG_ALLOCCHECK()
Check all allocations
- MX_ATOM
Base class for reference counting and delete locking
- # define MXATOM(v)
Convert to MX_ATOM
- # define mx_atom(a,d,s)
Construct an MX_ATOM
- # define mx_delete(a)
Destroy an MX_ATOM
- # define mx_locked(a)
Find out if an object is locked or not
- MX_LOCK
Stop MX_ATOMs from getting deleted
- # define mx_lock(l,a)
Construct a MX_LOCK
- unsigned mx_unlock(MX_LOCK* lock)
Destruct a MX_LOCK
- unsigned mx_lastlock(const MX_LOCK* lock)
Find out if a lock is the last one of an object
- # define MX_REF(type)
A reference type, a typed MX_LOCK
- # define mx_ref(r,t)
Construct a MX_REF
- # define mx_unref(r)
Destruct a MX_REF
- # define MXREF(r)
Return the object behind a MX_REF
- void* mx__atom(MX_ATOM* atom, MX__ATOM_DESTRUCT destruct, size_t datasize)
Construct an MX_ATOM
- #define false
Macro for false.
- #define true
Macro for true.
- #define MX_DLLIST(type)
Double linked list
- #define MX_DLLIST_ELEM(type)
Elements for a double linked list
- #define MX_DLLIST_NODE(type,list)
Elements for a double linked list node
- #define MX_DLLIST_APPEND(o,p)
Insert a double linked element into a double linked list
- #define MX_DLLIST_PREPEND(o,p)
Insert a double linked element into a double linked list
- #define MX_DLLIST_REMOVE(o)
Remove a double linked list element from its list
- #define mx_dllist_first(o)
First element of a double linked list.
- #define mx_dllist_last(o)
Last element of a double linked list.
- #define mx_dllist_next(o)
Next element in the double linked list.
- #define mx_dllist_prev(o)
Previous element in the double linked list.
- #define mx_dllist_list(o)
List that an element is contained in.
- #define MX_MAX(x,y)
The maximum of two values.
- #define MX_MIN(x,y)
The minimum of two values.
- #define MX_MID(x,y,z)
The middle of three values.
- typedef void* (*MX_ALLOC) (size_t bytes);
A stdlib malloc-like function.
- typedef void* (*MX_REALLOC) (void* ptr, size_t bytes);
A stdlib realloc-like function.
- typedef void (*MX_FREE) (void* ptr);
A stdlib free-like function.
- MX_ALLOCATOR
A standard memory alloc/realloc/free tool
- MX_RECT
A basic rectangle
- # define MXRECT_VALID(A)
Is MX_RECT valid?
- # define MXRECT_INTERSECT(A, B, R)
Find intersection of two rectangles
- # define MXRECT_UNION(A, B, R)
Union of two rectangles.
- # define MXRECT_CONTAINS(R, X, Y)
Point contained in MX_RECT
- # define MXRECTS_OVERLAP(A, B)
Do MX_RECT overlap?
- void mx_rect_move(MX_RECT* rrect, int x, int y)
Move a MX_RECT
- void mx_rect_resize(MX_RECT* rrect, int w, int h)
Resize a MX_RECT
- MX_RECTATOM_DATA
MX_RECT with reference counting
- # define MXRECT(b)
Typesafe conversion between a class derived from MX_RECTATOM to a MX_RECT.
- # define mx_rectatom(r,d,s)
Construct a MX_RECTATOM
- # define mx_rectatom_place(r, rect)
Place a MX_RECTAOM at some specific rectangle.
- # define mx_x1(r)
MX_RECTATOM x1 value.
- # define mx_y1(r)
MX_RECTATOM y1 value.
- # define mx_x2(r)
MX_RECTATOM x2 value.
- # define mx_y2(r)
MX_RECTATOM y2 value.
- # define mx_w(r)
MX_RECTATOM width.
- # define mx_h(r)
MX_RECTATOM height.
- void* mx__rectatom(MX_RECTATOM_DATA* rectatom, MX__ATOM_DESTRUCT destruct, size_t size)
Construct a MX_RECTATOM.
- void mx__rectatom_place(MX_RECTATOM_DATA* rectatom, const MX_RECT* rrect)
Place a MX_RECTATOM
- MX_STRING
A string object
- void mx_string_realloc(MX_STRING* string, const MX_ALLOC alloc, const MX_FREE dfree)
Reallocate a MX_STRING
- void mx_string_set(MX_STRING* string, const char* text, int len, const MX_FREE dfree)
Set MX_STRING text and length
- void mx_string(MX_STRING* string)
Construct a MX_STRING
- void mx_string_free(MX_STRING* string)
Destruct a MX_STRING
- const char* mx_string_text(const MX_STRING* string, int* len)
Get MX_STRING text and length
- int mx_string_len(const MX_STRING* string)
Get MX_STRING length
- #define MX_TREE(type)
Declare elements for a tree structure
- #define MX_TREE_INSERT(o,p)
Insert a tree element into a parent.
- #define MX_TREE_REMOVE(o)
Remove a tree element from a parent.
- #define mx_tree_first(o)
The first child element of a parent.
- #define mx_tree_last(o)
The last child element of a parent.
- #define mx_tree_next(o)
The next child element with the same parent.
- #define mx_tree_prev(o)
The previous child element with the same parent.
- #define mx_tree_parent(o)
The parent tree element.
- #define MX_VECTOR(type)
A 100% typesafe generic vector for C
- #define MX_VECTOR_ITERATOR(type)
An iterator for a MX_VECTOR
- #define mx_vector(mxvect)
Construct a MX_VECTOR
- #define mx_vector_free(mxvect)
Destruct a MX_VECTOR
- #define mx_vector_at(mxvect, mxn)
Return an element from a MX_VECTOR at a specific index
- #define mx_vector_back(mxvect)
Return the last element from a MX_VECTOR
- #define mx_vector_begin(mxvect)
Pointer to first element
- #define mx_vector_capacity(mxvect)
Capacity
- #define mx_vector_clear(mxvect)
Clear
- #define mx_vector_empty(mxvect)
Empty
- #define mx_vector_end(mxvect)
Pointer one-past last element
- #define mx_vector_erase(mxvect, mxiter)
Erase an element
- #define mx_vector_push_back(mxvect, mxdat)
Push an element onto the back of the MX_VECTOR
- #define mx_vector_size(mxvect)
Number of elements
- #define mx_vector_resize(mxvect, n)
Resize
- #define mx_vector_reserve(mxvect, n)
Set capacity
- #define mx_vector_extend(mxvect, n)
Increase capacity
- #define mx_vector_contract(mxvect)
Reduce capacity to minimum
- #define mx_vector_append1(mxvect, dat)
Append 1 element (bitwise copy)
- #define mx_vector_append(mxvect, dat, n)
Append a number of elements (bitwise copy)
- #define mx_vector_insert1(mxvect, dat, ind)
Insert 1 element (bitwise copy)
- #define mx_vector_insert(mxvect, dat, n, ind)
Insert a number of elements (bitwise copy)
- #define mx_vector_remove_last(mxvect)
Remove last element
- size_t mx__vector_makeroom(MX__VECTOR_DATA* vect, const size_t num, const size_t place, const size_t sizeofdata)
Generated by MXDOC 2.2 on Sun Feb 4 15:16:27 2007