{"LLOCKFLAGS", fun_lockflags, 0, 1, FN_REG},
{"LLOCKS", fun_locks, 1, 1, FN_REG},
{"LMATH", fun_lmath, 2, 3, FN_REG},
- {"LNUM", fun_lnum, 1, 3, FN_REG},
+ {"LNUM", fun_lnum, 1, 4, FN_REG},
{"LOC", fun_loc, 1, 1, FN_REG},
{"LOCTREE", fun_loctree, 1, 1, FN_REG},
{"LOCALIZE", fun_localize, 1, 1, FN_NOPARSE},
NVAL j;
NVAL start;
NVAL end;
- int istart, iend, k;
+ NVAL step = 1.0;
+ int istart, iend, k, istep;
char const *osep = " ";
static NVAL cstart[CACHE_SIZE];
static NVAL cend[CACHE_SIZE];
static char csep[CACHE_SIZE][BUFFER_LEN];
static char cresult[CACHE_SIZE][BUFFER_LEN];
+ static int cstep[CACHE_SIZE];
static int cpos;
char *cp;
safe_str(T(e_num), buff, bp);
return;
}
+ if (nargs > 3 && is_number(args[3])) {
+ step = parse_number(args[3]);
+ }
start = end;
end = parse_number(args[1]);
if ((start == 0) && (end == 0)) {
osep = args[2];
}
for (k = 0; k < CACHE_SIZE; k++) {
- if (cstart[k] == start && cend[k] == end && !strcmp(csep[k], osep)) {
+ if (cstart[k] == start && cend[k] == end && !strcmp(csep[k], osep) &&
+ cstep[k] == step) {
safe_str(cresult[k], buff, bp);
return;
}
istart = (int) start;
iend = (int) end;
- if (istart == start && iend == end) {
+ istep = (int) step;
+ if (istart == start && iend == end && istep == step) {
safe_integer(istart, cresult[cpos], &cp);
if (istart <= iend) {
- for (k = istart + 1; k <= iend; k++) {
+ for (k = istart + istep; k <= iend; k += istep) {
safe_str(osep, cresult[cpos], &cp);
if (safe_integer(k, cresult[cpos], &cp))
break;
}
} else {
- for (k = istart - 1; k >= iend; k--) {
+ for (k = istart - istep; k >= iend; k -= istep) {
safe_str(osep, cresult[cpos], &cp);
if (safe_integer(k, cresult[cpos], &cp))
break;
} else {
safe_number(start, cresult[cpos], &cp);
if (start <= end) {
- for (j = start + 1; j <= end; j++) {
+ for (j = start + step; j <= end; j += step) {
safe_str(osep, cresult[cpos], &cp);
if (safe_number(j, cresult[cpos], &cp))
break;
}
} else {
- for (j = start - 1; j >= end; j--) {
+ for (j = start - step; j >= end; j -= step) {
safe_str(osep, cresult[cpos], &cp);
if (safe_number(j, cresult[cpos], &cp))
break;