KiCad PCB EDA Suite
lists.h File Reference

Go to the source code of this file.

Macros

#define MACRO_BEGIN
 
#define MACRO_END
 
#define list_forall(elt, list)   for( elt = list; elt != NULL; elt = elt->next )
 
#define list_find(elt, list, c)
 
#define list_forall2(elt, list, hook)   for( elt = list, hook = &list; elt != NULL; hook = &elt->next, elt = elt->next )
 
#define list_find2(elt, list, c, hook)
 
#define _list_forall_hook(list, hook)   for( hook = &list; *hook != NULL; hook = &( *hook )->next )
 
#define _list_find_hook(list, c, hook)
 
#define list_insert_athook(elt, hook)
 
#define list_insert_beforehook(elt, hook)
 
#define list_unlink_athook(list, elt, hook)
 
#define list_unlink(listtype, list, elt)
 
#define list_prepend(list, elt)
 
#define list_append(listtype, list, elt)
 
#define list_unlink_cond(listtype, list, elt, c)
 
#define list_nth(elt, list, n)
 
#define list_nth_hook(elt, list, n, hook)
 
#define list_length(listtype, list, n)
 
#define list_index(list, n, elt, c)
 
#define list_count(list, n, elt, c)
 
#define list_forall_unlink(elt, list)   for( elt = list; elt ? ( list = elt->next, elt->next = NULL ), 1 : 0; elt = list )
 
#define list_reverse(listtype, list)
 
#define list_insert_ordered(listtype, list, elt, tmp, cond)
 
#define list_sort(listtype, list, a, b, cond)
 
#define list_mergesort(listtype, list, a, b, cond)
 
#define _list_merge_cond(listtype, a, b, cond, result)
 
#define dlist_append(head, end, elt)
 
#define dlist_forall_unlink(elt, head, end)
 
#define dlist_unlink_first(head, end, elt)
 

Macro Definition Documentation

#define _list_find_hook (   list,
  c,
  hook 
)
Value:
MACRO_BEGIN _list_forall_hook( list, hook ) if( c ) \
break; \
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
#define _list_forall_hook(list, hook)
Definition: lists.h:64
#define MACRO_BEGIN
Definition: lists.h:33
#define MACRO_END
Definition: lists.h:36

Definition at line 67 of file lists.h.

#define _list_forall_hook (   list,
  hook 
)    for( hook = &list; *hook != NULL; hook = &( *hook )->next )

Definition at line 64 of file lists.h.

#define _list_merge_cond (   listtype,
  a,
  b,
  cond,
  result 
)
Value:
MACRO_BEGIN \
listtype * *_hook; \
_hook = &( result ); \
while( 1 ) \
{ \
if( a == NULL ) \
{ \
*_hook = b; \
break; \
} \
else if( b == NULL ) \
{ \
*_hook = a; \
break; \
} \
else if( cond ) \
{ \
*_hook = a; \
_hook = &( a->next ); \
a = a->next; \
} \
else \
{ \
*_hook = b; \
_hook = &( b->next ); \
b = b->next; \
} \
} \
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
#define MACRO_END
Definition: lists.h:36

Definition at line 258 of file lists.h.

#define dlist_append (   head,
  end,
  elt 
)
Value:
MACRO_BEGIN \
elt->prev = end; \
elt->next = NULL; \
if( end ) \
{ \
end->next = elt; \
} \
else \
{ \
head = elt; \
} \
end = elt; \
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
#define MACRO_END
Definition: lists.h:36

Definition at line 292 of file lists.h.

#define dlist_forall_unlink (   elt,
  head,
  end 
)
Value:
for( elt = head; \
elt ? ( head = elt->next, elt->next = NULL, elt->prev = NULL ), 1 : ( end = NULL, 0 ); \
elt = head )

Definition at line 308 of file lists.h.

#define dlist_unlink_first (   head,
  end,
  elt 
)
Value:
MACRO_BEGIN \
elt = head; \
if( head ) \
{ \
head = head->next; \
if( head ) \
{ \
head->prev = NULL; \
} \
else \
{ \
end = NULL; \
} \
elt->prev = NULL; \
elt->next = NULL; \
} \
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
#define MACRO_END
Definition: lists.h:36

Definition at line 314 of file lists.h.

#define list_append (   listtype,
  list,
  elt 
)
Value:
MACRO_BEGIN \
listtype * *_hook; \
_list_forall_hook( list, _hook ) \
{ \
} \
list_insert_athook( elt, _hook ); \
#define _list_forall_hook(list, hook)
Definition: lists.h:64
#define MACRO_END
Definition: lists.h:36
#define list_insert_athook(elt, hook)
Definition: lists.h:73

Definition at line 113 of file lists.h.

Referenced by pathlist_to_tree().

#define list_count (   list,
  n,
  elt,
 
)
Value:
MACRO_BEGIN \
n = 0; \
list_forall( elt, list ) \
{ \
if( c ) \
n++; \
} \
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
#define MACRO_END
Definition: lists.h:36
#define list_forall(elt, list)
Definition: lists.h:44

Definition at line 175 of file lists.h.

#define list_find (   elt,
  list,
 
)
Value:
MACRO_BEGIN list_forall( elt, list ) if( c ) \
break; \
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
#define MACRO_BEGIN
Definition: lists.h:33
#define MACRO_END
Definition: lists.h:36
#define list_forall(elt, list)
Definition: lists.h:44

Definition at line 48 of file lists.h.

#define list_find2 (   elt,
  list,
  c,
  hook 
)
Value:
MACRO_BEGIN list_forall2( elt, list, hook ) if( c ) \
break; \
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
#define MACRO_BEGIN
Definition: lists.h:33
#define MACRO_END
Definition: lists.h:36
#define list_forall2(elt, list, hook)
Definition: lists.h:54

Definition at line 58 of file lists.h.

#define list_forall (   elt,
  list 
)    for( elt = list; elt != NULL; elt = elt->next )

Definition at line 44 of file lists.h.

Referenced by pathlist_to_tree(), and process_path().

#define list_forall2 (   elt,
  list,
  hook 
)    for( elt = list, hook = &list; elt != NULL; hook = &elt->next, elt = elt->next )

Definition at line 54 of file lists.h.

#define list_forall_unlink (   elt,
  list 
)    for( elt = list; elt ? ( list = elt->next, elt->next = NULL ), 1 : 0; elt = list )

Definition at line 186 of file lists.h.

Referenced by bm_to_pathlist(), pathlist_free(), and pathlist_to_tree().

#define list_index (   list,
  n,
  elt,
 
)
Value:
MACRO_BEGIN \
n = 0; \
list_forall( elt, list ) \
{ \
if( c ) \
break; \
n++; \
} \
if( !elt ) \
n = -1; \
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
#define MACRO_END
Definition: lists.h:36
#define list_forall(elt, list)
Definition: lists.h:44

Definition at line 161 of file lists.h.

#define list_insert_athook (   elt,
  hook 
)
Value:
MACRO_BEGIN elt->next = *hook; \
*hook = elt; \
#define MACRO_BEGIN
Definition: lists.h:33
#define MACRO_END
Definition: lists.h:36

Definition at line 73 of file lists.h.

#define list_insert_beforehook (   elt,
  hook 
)
Value:
MACRO_BEGIN elt->next = *hook; \
*hook = elt; \
hook = &elt->next; \
#define MACRO_BEGIN
Definition: lists.h:33
#define MACRO_END
Definition: lists.h:36

Definition at line 79 of file lists.h.

Referenced by bm_to_pathlist(), and pathlist_to_tree().

#define list_insert_ordered (   listtype,
  list,
  elt,
  tmp,
  cond 
)
Value:
MACRO_BEGIN \
listtype * *_hook; \
_list_find_hook( list, ( tmp = *_hook, ( cond ) ), _hook ); \
list_insert_athook( elt, _hook ); \
#define _list_find_hook(list, c, hook)
Definition: lists.h:67
#define MACRO_END
Definition: lists.h:36
#define list_insert_athook(elt, hook)
Definition: lists.h:73

Definition at line 208 of file lists.h.

#define list_length (   listtype,
  list,
 
)
Value:
MACRO_BEGIN \
listtype * _elt; \
n = 0; \
list_forall( _elt, list ) n++; \
#define MACRO_END
Definition: lists.h:36
#define list_forall(elt, list)
Definition: lists.h:44

Definition at line 152 of file lists.h.

#define list_mergesort (   listtype,
  list,
  a,
  b,
  cond 
)
Value:
MACRO_BEGIN \
listtype * _elt, **_hook1; \
\
for( _elt = list; _elt; _elt = _elt->next1 ) \
{ \
_elt->next1 = _elt->next; \
_elt->next = NULL; \
} \
do \
{ \
_hook1 = &( list ); \
while( ( a = *_hook1 ) != NULL && ( b = a->next1 ) != NULL ) \
{ \
_elt = b->next1; \
_list_merge_cond( listtype, a, b, cond, *_hook1 ); \
_hook1 = &( ( *_hook1 )->next1 ); \
*_hook1 = _elt; \
} \
} \
while( _hook1 != &( list ) ); \
#define MACRO_END
Definition: lists.h:36
#define _list_merge_cond(listtype, a, b, cond, result)
Definition: lists.h:258

Definition at line 234 of file lists.h.

#define list_nth (   elt,
  list,
 
)
Value:
MACRO_BEGIN \
int _x; /* only evaluate n once */ \
for( _x = ( n ), elt = list; _x && elt; _x--, elt = elt->next ) \
{ \
} \
#define MACRO_END
Definition: lists.h:36

Definition at line 132 of file lists.h.

#define list_nth_hook (   elt,
  list,
  n,
  hook 
)
Value:
MACRO_BEGIN \
int _x; /* only evaluate n once */ \
for( _x = ( n ), elt = list, hook = &list; _x && elt; \
_x--, hook = &elt->next, elt = elt->next ) \
{ \
} \
#define MACRO_END
Definition: lists.h:36

Definition at line 142 of file lists.h.

#define list_prepend (   list,
  elt 
)
Value:
MACRO_BEGIN elt->next = list; \
list = elt; \
#define MACRO_BEGIN
Definition: lists.h:33
#define MACRO_END
Definition: lists.h:36

Definition at line 107 of file lists.h.

#define list_reverse (   listtype,
  list 
)
Value:
MACRO_BEGIN \
listtype * _list1 = NULL, *elt; \
list_forall_unlink( elt, list ) list_prepend( _list1, elt ); \
list = _list1; \
#define list_prepend(list, elt)
Definition: lists.h:107
#define list_forall_unlink(elt, list)
Definition: lists.h:186
#define MACRO_END
Definition: lists.h:36

Definition at line 190 of file lists.h.

#define list_sort (   listtype,
  list,
  a,
  b,
  cond 
)
Value:
MACRO_BEGIN \
listtype * _newlist = NULL; \
list_forall_unlink( a, list ) list_insert_ordered( listtype, _newlist, a, b, cond ); \
list = _newlist; \
#define list_forall_unlink(elt, list)
Definition: lists.h:186
#define MACRO_END
Definition: lists.h:36
#define list_insert_ordered(listtype, list, elt, tmp, cond)
Definition: lists.h:208

Definition at line 222 of file lists.h.

#define list_unlink (   listtype,
  list,
  elt 
)
Value:
MACRO_BEGIN \
listtype * *_hook; \
_list_find_hook( list, *_hook == elt, _hook ); \
list_unlink_athook( list, elt, _hook ); \
#define _list_find_hook(list, c, hook)
Definition: lists.h:67
#define MACRO_END
Definition: lists.h:36
#define list_unlink_athook(list, elt, hook)
Definition: lists.h:87

Definition at line 99 of file lists.h.

#define list_unlink_athook (   list,
  elt,
  hook 
)
Value:
MACRO_BEGIN \
elt = hook ? *hook : NULL; \
if( elt ) \
{ \
*hook = elt->next; \
elt->next = NULL; \
} \
if(dlg.ShowModal()==wxID_OK)
Definition: selcolor.cpp:75
#define MACRO_END
Definition: lists.h:36

Definition at line 87 of file lists.h.

#define list_unlink_cond (   listtype,
  list,
  elt,
 
)
Value:
MACRO_BEGIN \
listtype * *_hook; \
list_find2( elt, list, c, _hook ); \
list_unlink_athook( list, elt, _hook ); \
#define list_find2(elt, list, c, hook)
Definition: lists.h:58
#define MACRO_END
Definition: lists.h:36
#define list_unlink_athook(list, elt, hook)
Definition: lists.h:87

Definition at line 123 of file lists.h.

#define MACRO_BEGIN
Value:
do \
{

Definition at line 33 of file lists.h.

#define MACRO_END
Value:
} \
while( 0 )

Definition at line 36 of file lists.h.