repo.or.cz
/
eigenmath-fx.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Little fix after the last commit (mostly a git fail)
[eigenmath-fx.git]
/
for.cpp
blob
7f384ed7357a9e0c109ed7f8cd8a32fe226beeac
1
// 'for' function
2
3
#include
"stdafx.h"
4
#include
"defs.h"
5
6
#define A p3
7
#define B p4
8
#define I p5
9
#define X p6
10
11
void
12
eval_for
(
void
)
13
{
14
int
i
,
j
,
k
;
15
16
// 1st arg (quoted)
17
18
X
=
cadr
(
p1
);
19
if
(!
issymbol
(
X
))
20
stop
(
"for: 1st arg?"
);
21
22
// 2nd arg
23
24
push
(
caddr
(
p1
));
25
eval
();
26
j
=
pop_integer
();
27
if
(
j
== (
int
)
0x80000000
)
28
stop
(
"for: 2nd arg?"
);
29
30
// 3rd arg
31
32
push
(
cadddr
(
p1
));
33
eval
();
34
k
=
pop_integer
();
35
if
(
k
== (
int
)
0x80000000
)
36
stop
(
"for: 3rd arg?"
);
37
38
// remaining args
39
40
p1
=
cddddr
(
p1
);
41
42
B
=
get_binding
(
X
);
43
A
=
get_arglist
(
X
);
44
45
for
(
i
=
j
;
i
<=
k
;
i
++) {
46
push_integer
(
i
);
47
I
=
pop
();
48
set_binding
(
X
,
I
);
49
p2
=
p1
;
50
while
(
iscons
(
p2
)) {
51
push
(
car
(
p2
));
52
eval
();
53
pop
();
54
p2
=
cdr
(
p2
);
55
}
56
}
57
58
set_binding_and_arglist
(
X
,
B
,
A
);
59
60
// return value
61
62
push_symbol
(
NIL
);
63
}
64