[Turn off line numbering]1: arg rng, current; 2: var start, end, out, listm, m, x, list; 3: 4: list = current['list]; 5: listm = list.mail(); 6: if (type(rng[1]) == 'integer) { 7: start = rng[1]; 8: } else { 9: switch (rng[1]) { 10: case 'end: 11: if (type(rng[2]) != 'symbol) 12: throw(~range, "Backwards range."); 13: start = current['list].mail().length(); 14: case 'start: 15: start = 1; 16: case 'current: 17: start = current['location] in listm; 18: case 'specific: 19: out = []; 20: for m in (rng[2].explode_english_list()) { 21: if (!(x = toint(m)) || x < 1) { 22: sender().tell("Ignoring list range element '" + m + "'."); 23: } else { 24: catch ~range 25: out = setadd(out, (> listm[x] <)); 26: with 27: sender().tell("List range #" + x + " is higher than the messages in " + list.mail_name() + " (" + listm.length() + ")"); 28: } 29: } 30: return out || throw(~range, "No elements in list range."); 31: } 32: } 33: if (type(rng[2]) == 'integer) { 34: end = rng[2]; 35: } else { 36: switch (rng[2]) { 37: case 'end: 38: end = current['list].mail().length(); 39: case 'single: 40: end = start; 41: case 'start: 42: throw(~range, "Backwards range."); 43: case 'current: 44: end = current['location] in current['list].mail(); 45: } 46: } 47: if (start > end) 48: throw(~range, "Backwards range."); 49: out = []; 50: for m in [start .. end] { 51: catch ~range 52: out = setadd(out, (> listm[m] <)); 53: with 54: sender().tell("List range #" + m + " is higher than the messages in " + list.mail_name() + " (" + listm.length() + ")"); 55: } 56: return out || throw(~range, "No elements in list range.");
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit