[go: up one dir, main page]

Menu

[r49]: / trunk / eval.exw  Maximize  Restore  History

Download this file

63 lines (49 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
with trace
-- Even though this gets included by eval, you can't use it directly in
-- code below, because the include doesn't happen at compile time. It has
-- to wait until run time.
? eval( "include gl.e\n")
if not eval("? o") then
printf(2,"Eval Error: %s\n", {eval_error()})
end if
atom a
a = 1
trace(1)
? var_id("a")
sequence code
code = "procedure bar()\n" &
"\tputs(1,\"bar!\\n\")\n" &
"end procedure\n" &
"bar()\n" &
"euclass generic( object g )\n" &
" procedure method()\n" &
" puts(1,\"Generic Method dynamically defined!\\n\")\n" &
" end procedure\n" &
"end euclass\n" &
"generic G\n" &
"G = 0\n" &
"G.method()\n"
printf(1, "rid(foo) = %d\n", routine_id("foo"))
global procedure foo()
integer f
f = 3
puts(1,"foo!\n")
? f
if eval("? f") = 0 then
printf(2,"Eval Error: %s\n", {eval_error()})
end if
for i = 1 to 1 do
if eval("printf(1,\"i = %d\\n\",i)") = 0 then
printf(2,"Eval Error: %s\n", {eval_error()})
end if
end for
?{2}
f = eval("?{2}")
if not eval(code) then
printf(2,"Eval Error: %s\n", {eval_error()})
end if
end procedure
foo()
? eval( "t1 x\nx = 5\n? x\n? {var_id(\"x\")}\n")
printf(1,"var_id(\"x\") = %d\n", {var_id("x")})
? eval( "Global.GlobalMethod(1)")