MCPcopy Create free account
hub / github.com/boostorg/build / get_iters

Function get_iters

v2/engine/function.c:992–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

990 */
991
992static void get_iters( subscript_t const subscript, LISTITER * const first,
993 LISTITER * const last, int const length )
994{
995 int start;
996 int size;
997 LISTITER iter;
998 LISTITER end;
999 {
1000
1001 if ( subscript.sub1 < 0 )
1002 start = length + subscript.sub1;
1003 else if ( subscript.sub1 > length )
1004 start = length;
1005 else
1006 start = subscript.sub1 - 1;
1007
1008 size = subscript.sub2 < 0
1009 ? length + 1 + subscript.sub2 - start
1010 : subscript.sub2 - start;
1011
1012 /*
1013 * HACK: When the first subscript is before the start of the list, it
1014 * magically becomes the beginning of the list. This is inconsistent,
1015 * but needed for backwards compatibility.
1016 */
1017 if ( start < 0 )
1018 start = 0;
1019
1020 /* The "sub2 < 0" test handles the semantic error of sub2 < sub1. */
1021 if ( size < 0 )
1022 size = 0;
1023
1024 if ( start + size > length )
1025 size = length - start;
1026 }
1027
1028 iter = *first;
1029 while ( start-- > 0 )
1030 iter = list_next( iter );
1031
1032 end = iter;
1033 while ( size-- > 0 )
1034 end = list_next( end );
1035
1036 *first = iter;
1037 *last = end;
1038}
1039
1040static LIST * apply_modifiers_empty( LIST * result, string * buf,
1041 VAR_EDITS * edits, int n )

Callers 2

apply_subscriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected