Go to the source code of this file.
Defines | |
#define | array_foreach(type, instance, label) |
Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | array_foreach_const(type, instance, label) |
Constant fixed C array iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | array_foreach_reverse(type, instance, label) |
Backward C array iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | array_foreach_const_reverse(type, instance, label) |
Backward, constant C array iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | pointer_foreach(type, instance, count, label) |
Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | pointer_foreach_const(type, instance, count, label) |
Constant fixed C array iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | pointer_foreach_reverse(type, instance, count, label) |
Backward C array iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | pointer_foreach_const_reverse(type, instance, count, label) |
Backward, constant C array iterator Iterator is available after loop, so these loops should be wrapped in their own { } braces, if you don't want it interfering with other code. | |
#define | exponents_2(p1, p2, begin, end) |
Do exponential sets of p1,p2 Iterates combinations of p1,p2 like a counter; so begin of 0 and end of 10 would count from 00 to 99. exponents_2( p1,p2, 0,3 ) -> 00,01,02,10,11,12,20,21,22 Combinations come up sorted from p1->p2. | |
#define | exponents_2_calc(begin, end) ( ((end)-(begin)) * ((end)-(begin)) ) |
Return count of iterations exponents_2 represents. | |
#define | arrangements_2(p1, p2, begin, end) |
Do arrangements of p1,p2 Iterates all arrangements of p1,p2; 1,2 and 2,1 appear, but not 1,1 or 2,2 arrangements_2( p1,p2, 0,4 ) -> 01,02,03,10,12,13,20,21,23,30,31,32 Combinations come up sorted from p1->p2 Basically, does the exponential iteration and filters out items that contain matches. | |
#define | arrangements_2_calc(begin, end) ( ((end)-(begin)) * ((end)-(begin)-1) ) |
Return count of iterations arrangements_2 represents. | |
#define | combinations_2(p1, p2, begin, end) |
Do combinations/boxed arrangements of p1,p2 Only iterates unique combinations; i.e. 1,2 and 2,1 will not both appear combinations_2( p1,p2, 0,4 ) -> 01,02,03,12,13,23 Combinations come up sorted from p1->p2. | |
#define | combinations_2_calc(begin, end) ( ((end)-(begin)) * ((end)-(begin)-1) / (2) ) |
Return count of iterations combinations_2 represents. | |
#define | exponents_3(p1, p2, p3, begin, end) |
Do exponential sets of p1,p2,p3 Iterates combinations of p1,p2,p3 like a counter; so begin of 0 and end of 10 would count from 000 to 999. Combinations come up sorted from p1->p3. | |
#define | exponents_3_calc(begin, end) ( ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) ) |
Return count of iterations exponents_3 represents. | |
#define | arrangements_3(p1, p2, p3, begin, end) |
Do non-unique integer permutations of p1,p2,p3 Iterates all arrangements of p1,p2,p3; 1,2,3 and 3,2,1 appear, but not 1,1,3 or 2,2,2 Combinations come up sorted from p1->p3 Basically, does the exponential iteration and filters out items that contain matches. | |
#define | arrangements_3_calc(begin, end) ( ((end)-(begin)) * ((end)-(begin)-1) * ((end)-(begin)-2) ) |
Return count of iterations arrangements_3 represents. | |
#define | combinations_3(p1, p2, p3, begin, end) |
Do combinations/boxed arrangements of p1,p2 Only iterates unique combinations; i.e. 1,2,3 and 3,2,1 will not both appear Combinations come up sorted from p1->p3. | |
#define | combinations_3_calc(begin, end) ( ((end)-(begin)) * ((end)-(begin)-1) * ((end)-(begin)-2) / (3*2) ) |
Return count of iterations combinations_3 represents. | |
#define | exponents_4(p1, p2, p3, p4, begin, end) |
Do exponential sets of p1,p2,p3,p4 Iterates combinations of p1,p2 like a counter; so begin of 0 and end of 10 would count from 0 to 9999. Combinations come up sorted from p1->p2. | |
#define | exponents_4_calc(begin, end) ( ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) ) |
Return count of iterations exponents_4 represents. | |
#define | arrangements_4(p1, p2, p3, p4, begin, end) |
Do non-unique integer permutations of p1,p2,p3,p4 Iterates all arrangements of p1,p2,p3,p4; 1,2,3,4 and 4,3,2,1 appear, but not 1,1,3,4 or 2,2,2,3 Combinations come up sorted from p1->p4 Basically, does the exponential iteration and filters out items that contain matches. | |
#define | arrangements_4_calc(begin, end) (((end)-(begin))*(((end)-(begin))-1)*(((end)-(begin))-2)*(((end)-(begin))-3)) |
Return count of iterations arrangements_4 represents. | |
#define | combinations_4(p1, p2, p3, p4, begin, end) |
Do unique integer permutations of p1,p2,p3,p4 Only iterates unique combinations; i.e. 1,2,3,4 and 4,3,2,1 will not both appear Combinations come up sorted from p1->p4. | |
#define | combinations_4_calc(begin, end) ((((end)-(begin))*(((end)-(begin))-1)*(((end)-(begin))-2)*(((end)-(begin))-3))/(4*3*2)) |
Return count of iterations combinations_4 represents. | |
#define | exponents_5(p1, p2, p3, p4, p5, begin, end) |
Do exponential sets of p1~p5 Iterates combinations of p1,p2 like a counter; so begin of 0 and end of 10 would count from 00000 to 99999. Combinations come up sorted from p1->p5. | |
#define | exponents_5_calc(begin, end) ( ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) ) |
Return count of iterations exponents_5 represents. | |
#define | arrangements_5(p1, p2, p3, p4, p5, begin, end) |
Do unique integer permutations of p1~p5 Iterates all arrangements of p1,p2,p3,p4; 1,2,3,4,5 and 5,4,3,2,1 appear, but not 1,1,3,4,5 or 2,2,2,3,4 Combinations come up sorted from p1->p4 Basically, does the exponential iteration and filters out items that contain matches. | |
#define | arrangements_5_calc(begin, end) (((end)-(begin))*(((end)-(begin))-1)*(((end)-(begin))-2)*(((end)-(begin))-3)*(((end)-(begin))-4)) |
Return count of iterations arrangements_5 represents. | |
#define | combinations_5(p1, p2, p3, p4, p5, begin, end) |
Do combinations/boxed arrangements of p1,p2 Only iterates unique combinations; i.e. 1,2,3,4,5 and 5,4,3,2,1 will not both appear Combinations come up sorted from p1->p5. | |
#define | combinations_5_calc(begin, end) ((((end)-(begin))*(((end)-(begin))-1)*(((end)-(begin))-2)*(((end)-(begin))-3)*(((end)-(begin))-4))/(5*4*3*2)) |
Return count of iterations combinations_5 represents. | |
#define | ppDuff(unroll, count, op) ppConcat(ppDuff,unroll)(count,op) |
Unroll a loop 'n' ways using Duff's Device. | |
#define | ppCombination3(op, fn, a, b, c) |
Do unique pairs of permutations of a,b,c. |
Definition in file iterate.h.
#define arrangements_2 | ( | p1, | |||
p2, | |||||
begin, | |||||
end | ) |
Value:
exponents_2( p1,p2, begin,end )\ if( (p1) != (p2) )
p1,p2 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define arrangements_2_calc | ( | begin, | |||
end | ) | ( ((end)-(begin)) * ((end)-(begin)-1) ) |
#define arrangements_3 | ( | p1, | |||
p2, | |||||
p3, | |||||
begin, | |||||
end | ) |
Value:
exponents_3( p1,p2,p3, begin,end )\ if( ppCombination3( &&, ppNOTEQUAL, p1,p2,p3 ) )
p1,p2,p3 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define arrangements_3_calc | ( | begin, | |||
end | ) | ( ((end)-(begin)) * ((end)-(begin)-1) * ((end)-(begin)-2) ) |
#define arrangements_4 | ( | p1, | |||
p2, | |||||
p3, | |||||
p4, | |||||
begin, | |||||
end | ) |
Value:
exponents_4( p1,p2,p3,p4, begin,end )\ if( ppCombination4( &&, ppNOTEQUAL, p1,p2,p3,p4 ) )
p1,p2,p3,p4 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define arrangements_4_calc | ( | begin, | |||
end | ) | (((end)-(begin))*(((end)-(begin))-1)*(((end)-(begin))-2)*(((end)-(begin))-3)) |
#define arrangements_5 | ( | p1, | |||
p2, | |||||
p3, | |||||
p4, | |||||
p5, | |||||
begin, | |||||
end | ) |
Value:
exponents_5( p1,p2,p3,p4,p5, begin,end )\ if( ppCombination5( &&, ppNOTEQUAL, p1,p2,p3,p4,p5 ) )
p1,p2,p3,p4,p5 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define arrangements_5_calc | ( | begin, | |||
end | ) | (((end)-(begin))*(((end)-(begin))-1)*(((end)-(begin))-2)*(((end)-(begin))-3)*(((end)-(begin))-4)) |
#define array_foreach | ( | type, | |||
instance, | |||||
label | ) |
Value:
type* label = (instance);\ type* ppConcat(endof_,label) = (label+countof(instance));\ for ( ; label < ppConcat(endof_,label); ++label )
type | What type is the collection | |
instance | Fully qualified instance of array; length must be known (i.e. for char array[max];, 'array') | |
label | What to call the iterator (i.e. curr) |
#define array_foreach_const | ( | type, | |||
instance, | |||||
label | ) |
Value:
const type* label = (const type*)(instance);\ const type* ppConcat(endof_,label) = (const type*)(label+countof(instance));\ for ( ; label < ppConcat(endof_,label); ++label )
type | What type is the collection | |
instance | Fully qualified instance of array; length must be known (i.e. for char array[max];, 'array') | |
label | What to call the iterator (i.e. curr) |
#define array_foreach_const_reverse | ( | type, | |||
instance, | |||||
label | ) |
Value:
const type* label = (const type*)((instance)+countof(instance));\ while ( label-- > (instance) )
type | What type is the collection | |
instance | Fully qualified instance of array; length must be known (i.e. for char array[max];, 'array') | |
label | What to call the iterator (i.e. curr) |
#define array_foreach_reverse | ( | type, | |||
instance, | |||||
label | ) |
Value:
type* label = ((instance)+countof(instance));\ while ( label-- > (instance) )
type | What type is the collection | |
instance | Fully qualified instance of array; length must be known (i.e. for char array[max];, 'array') | |
label | What to call the iterator (i.e. curr) |
#define combinations_2 | ( | p1, | |||
p2, | |||||
begin, | |||||
end | ) |
Value:
for( (p1) = (begin); (p1) < ((end)-1); ++(p1) )\ for( (p2) = (p1)+1; (p2) < (end); ++(p2) )
p1,p2 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define combinations_2_calc | ( | begin, | |||
end | ) | ( ((end)-(begin)) * ((end)-(begin)-1) / (2) ) |
#define combinations_3 | ( | p1, | |||
p2, | |||||
p3, | |||||
begin, | |||||
end | ) |
Value:
for( (p1) = (begin); (p1) < ((end)-2); ++(p1) )\ for( (p2) = (p1)+1; (p2) < ((end)-1); ++(p2) )\ for( (p3) = (p2)+1; (p3) < (end); ++(p3) )
p1,p2,p3 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define combinations_3_calc | ( | begin, | |||
end | ) | ( ((end)-(begin)) * ((end)-(begin)-1) * ((end)-(begin)-2) / (3*2) ) |
#define combinations_4 | ( | p1, | |||
p2, | |||||
p3, | |||||
p4, | |||||
begin, | |||||
end | ) |
Value:
for( (p1) = (begin); (p1) < ((end)-3); ++(p1) )\ for( (p2) = (p1)+1; (p2) < ((end)-2); ++(p2) )\ for( (p3) = (p2)+1; (p3) < ((end)-1); ++(p3) )\ for( (p4) = (p3)+1; (p4) < (end); ++(p4) )
p1,p2,p3,p4 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define combinations_4_calc | ( | begin, | |||
end | ) | ((((end)-(begin))*(((end)-(begin))-1)*(((end)-(begin))-2)*(((end)-(begin))-3))/(4*3*2)) |
#define combinations_5 | ( | p1, | |||
p2, | |||||
p3, | |||||
p4, | |||||
p5, | |||||
begin, | |||||
end | ) |
Value:
for( (p1) = (begin); (p1) < ((end)-4); ++(p1) )\ for( (p2) = (p1)+1; (p2) < ((end)-3); ++(p2) )\ for( (p3) = (p2)+1; (p3) < ((end)-2); ++(p3) )\ for( (p4) = (p3)+1; (p4) < ((end)-1); ++(p4) )\ for( (p5) = (p4)+1; (p5) < (end); ++(p5) )
p1,p2,p3,p4,p5 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define combinations_5_calc | ( | begin, | |||
end | ) | ((((end)-(begin))*(((end)-(begin))-1)*(((end)-(begin))-2)*(((end)-(begin))-3)*(((end)-(begin))-4))/(5*4*3*2)) |
#define exponents_2 | ( | p1, | |||
p2, | |||||
begin, | |||||
end | ) |
Value:
for( (p1) = (begin); (p1) < (end); ++(p1) )\ for( (p2) = (begin); (p2) < (end); ++(p2) )\
p1,p2 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define exponents_2_calc | ( | begin, | |||
end | ) | ( ((end)-(begin)) * ((end)-(begin)) ) |
#define exponents_3 | ( | p1, | |||
p2, | |||||
p3, | |||||
begin, | |||||
end | ) |
Value:
for( (p1) = (begin); (p1) < (end); ++(p1) )\ for( (p2) = (begin); (p2) < (end); ++(p2) )\ for( (p3) = (begin); (p3) < (end); ++(p3) )\
p1,p2,p3 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define exponents_3_calc | ( | begin, | |||
end | ) | ( ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) ) |
#define exponents_4 | ( | p1, | |||
p2, | |||||
p3, | |||||
p4, | |||||
begin, | |||||
end | ) |
Value:
for( (p1) = (begin); (p1) < (end); ++(p1) )\ for( (p2) = (begin); (p2) < (end); ++(p2) )\ for( (p3) = (begin); (p3) < (end); ++(p3) )\ for( (p4) = (begin); (p4) < (end); ++(p4) )\
p1,p2,p3,p4 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define exponents_4_calc | ( | begin, | |||
end | ) | ( ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) ) |
#define exponents_5 | ( | p1, | |||
p2, | |||||
p3, | |||||
p4, | |||||
p5, | |||||
begin, | |||||
end | ) |
Value:
for( (p1) = (begin); (p1) < (end); ++(p1) )\ for( (p2) = (begin); (p2) < (end); ++(p2) )\ for( (p3) = (begin); (p3) < (end); ++(p3) )\ for( (p4) = (begin); (p4) < (end); ++(p4) )\ for( (p5) = (begin); (p5) < (end); ++(p5) )\
p1,p2,p3,p4,p5 | Loop variables to iterate combinations with | |
begin | First in series | |
end | Last in series, like stl end() (count == (end-begin)) |
#define exponents_5_calc | ( | begin, | |||
end | ) | ( ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) * ((end)-(begin)) ) |
#define pointer_foreach | ( | type, | |||
instance, | |||||
count, | |||||
label | ) |
Value:
type* label = (instance);\ type* ppConcat(endof_,label) = label+(count);\ for ( ; label < ppConcat(endof_,label); ++label )
type | What type is the collection | |
instance | Pointer to array of data | |
count | Count of items to iterate | |
label | What to call the iterator (i.e. curr) |
Definition at line 62 of file iterate.h.
Referenced by uint16_serial_readarray(), uint32_serial_readarray(), uint64_serial_readarray(), and wchar_t_serial_read_string().
#define pointer_foreach_const | ( | type, | |||
instance, | |||||
count, | |||||
label | ) |
Value:
const type* label = (const type*)(instance);\ const type* ppConcat(endof_,label) = (const type*)(label+(count)); \ for ( ; label < ppConcat(endof_,label); ++label )
type | What type is the collection | |
instance | Pointer to array of data | |
count | Count of items to iterate | |
label | What to call the iterator (i.e. curr) |
Definition at line 75 of file iterate.h.
Referenced by _GUI_Default(), _GUI_Explode_Set(), _GUI_Offset_Group(), _GUI_Sweep_Set(), _GUI_Ticker_SetText(), ClipRect_merge(), ClipRect_union(), GUI_tabdown(), GUI_tableft(), GUI_tabright(), GUI_tabup(), RGBQUAD_Nearest(), uint16_serial_writearray(), uint32_serial_writearray(), uint64_serial_writearray(), wchar_t_record_write_string(), and wchar_t_serial_write_string().
#define pointer_foreach_const_reverse | ( | type, | |||
instance, | |||||
count, | |||||
label | ) |
Value:
const type* label = (const type*)((instance)+(count));\ while ( label-- > (const type*)(instance) )
type | What type is the collection | |
instance | Instance of container | |
count | How many to iterate | |
label | What to call the iterator (i.e. curr) |
Definition at line 100 of file iterate.h.
Referenced by _GUI_Default().
#define pointer_foreach_reverse | ( | type, | |||
instance, | |||||
count, | |||||
label | ) |
Value:
type* label = ((instance)+(count));\
while ( label-- > (instance) )
type | What type is the collection | |
instance | Instance of container | |
count | Count of items to iterate | |
label | What to call the iterator (i.e. curr) |
#define ppCombination3 | ( | op, | |||
fn, | |||||
a, | |||||
b, | |||||
c | ) |
Value:
( \ fn((a),(b)) op fn((a),(c)) op \ fn((b),(c)) \ )
op | Operator (&&,||,+,-, etc.) to string invokations of fn together | |
fn | Function/macro to pass pairs to; like ppEQUAL(a,b) | |
a,b,c | Items to permute |
#define ppDuff | ( | unroll, | |||
count, | |||||
op | ) | ppConcat(ppDuff,unroll)(count,op) |