1: #include "../h/rt.h"
2: #ifdef XPX
3: /*
4: * seq(e1,e2) - generate e1, e1+e2, e1+e2+e2, ... .
5: */
6:
7: Xseq(nargs, arg2, arg1, arg0)
8: int nargs;
9: struct descrip arg2, arg1, arg0;
10: {
11: long from, by;
12:
13: /*
14: * Default e1 and e2 to 1.
15: */
16: defint(&arg1, &from, 1);
17: defint(&arg2, &by, 1);
18:
19: /*
20: * Produce error if e2 is 0, i.e., infinite sequence of e1's.
21: */
22: if (by == 0)
23: runerr(211, &arg2);
24:
25: /*
26: * Suspend sequence, stopping when largest or smallest integer
27: * is reached.
28: */
29: while ((from <= MAXLONG && by > 0) || (from >= MINLONG && by < 0)) {
30: mkint(from, &arg0);
31: suspend();
32: from += by;
33: }
34: fail();
35: }
36:
37: Procblock(seq,2)
38:
39: #else XPX
40: char junk; /* prevent null object file */
41: #endif XPX
Defined functions
Xseq
defined in line
7;
never used