]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/perl | |
2 | ||
3 | %keys = | |
4 | ( | |
5 | "s" => "RESP_STR", | |
6 | "d" => "RESP_DSC", | |
7 | "i" => "RESP_INT", | |
8 | "I" => "RESP_LNUM", | |
9 | "f" => "RESP_FLOAT" | |
10 | ); | |
11 | ||
12 | print(" | |
13 | /* Do not modify this file - it is autogenerated by makecmds */ | |
14 | ||
15 | static void initcmds(void) | |
16 | { | |
17 | struct command *cmd; | |
18 | ||
19 | "); | |
20 | ||
21 | while(<>) | |
22 | { | |
23 | ($comment) = /\s*;\s*(.*)$/; | |
24 | s/\s*;.*$//; | |
25 | if(($name) = /^:(\w*)/) | |
26 | { | |
27 | if($name) | |
28 | { | |
29 | print(" cmd = makecmd(L\"$name\");"); | |
30 | } else { | |
31 | print(" cmd = makecmd(NULL);"); | |
32 | } | |
33 | if($comment) | |
34 | { | |
35 | print("\t/* $comment */"); | |
36 | } | |
37 | print("\n"); | |
38 | } elsif(/^([0-9]{3})\s+/g) { | |
39 | print(" addresp(cmd, $1"); | |
40 | print(", " . $keys{$1}) while /\G(\S+)\s+/g; | |
41 | print(", RESP_END);"); | |
42 | if($comment) | |
43 | { | |
44 | print("\t/* $comment */"); | |
45 | } | |
46 | print("\n"); | |
47 | } | |
48 | } | |
49 | ||
50 | print("}\n"); |