_d_switch_string

Support for switch statements switching on strings. Input: table[] sorted array of strings generated by compiler ca string to look up in table Output: result index of match in table[] -1 if not in table

extern (C)
int
_d_switch_string
(
char[][] table
,
char[] ca
)
out (result) { int i; int cj; if (result == -1) { for ( i = 0; i < table.length; i++) { if (table[i].length == ca.length) { cj = memcmp(table[i].ptr, ca.ptr, ca.length); assert (cj != 0); } } } else { assert (0 <= result && result < table.length); for ( i = 0; 1; i++) { assert (i < table.length); if (table[i].length == ca.length) { cj = memcmp(table[i].ptr, ca.ptr, ca.length); if (cj == 0) { assert (i == result); break; } } } } }

Meta