-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdoccer.rb
More file actions
45 lines (40 loc) · 724 Bytes
/
doccer.rb
File metadata and controls
45 lines (40 loc) · 724 Bytes
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
horregex = Regexp.new '\/\*\s*\((.*)\)\s+(.*)\s+\*\/\s+prim\s+(P_.*)\('
x = <<TEXT
/*
( addr -- *addr )
Fetch value from address
*/
prim P_at(pez_instance *p)
{
Sl(1);
Hpc(S0);
S0 = *((pez_stackitem *)S0);
}
/*
( n addr -- )
Add top of stack to value at specified address
*/
prim P_plusbang(pez_instance *p)
{
Sl(2);
Hpc(S0);
*((pez_stackitem *)S0) += S1;
Pop2;
}
/*
( addr -- )
Increments (by 1) the variable at the specified address.
*/
prim P_1plusbang(pez_instance *p)
{
Sl(1);
Hpc(S0);
(*((pez_stackitem *)S0))++;
Pop;
}
TEXT
x = File.read("pez.c")
require 'pp'
fns = x.scan(horregex).map { |fn| name = fn.delete_at(2); fn.unshift name }
fns.sort! {|a,b| a.first <=> b.first }
pp *fns