|
OLD | NEW |
---|---|
(Empty) | |
1 | |
jam
2011/03/09 06:33:45
nit: empty line
| |
2 #include <iostream> | |
3 #include <string> | |
4 | |
Paweł Hajdan Jr.
2011/03/09 15:56:41
I think you really want this file in chrome/tools.
| |
5 // Include once to get the type definitions | |
6 #include "chrome/common/common_message_generator.h" | |
7 | |
8 struct msginfo { | |
9 const char* name; | |
10 int id; | |
11 int in_count; | |
12 int out_count; | |
13 }; | |
14 | |
15 // Redefine macros to generate table | |
16 #include "ipc/ipc_message_null_macros.h" | |
17 #undef IPC_MESSAGE_DECL | |
18 #define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \ | |
19 { #name, IPC_MESSAGE_ID(), in, out }, | |
20 | |
21 static const struct msginfo msgtable[] = { | |
22 #include "chrome/common/common_message_generator.h" | |
23 }; | |
24 | |
25 int main(int argc, char **argv) { | |
26 bool show_args = false; | |
27 bool show_ids = false; | |
28 | |
29 while (--argc > 0) { | |
30 ++argv; | |
31 if (std::string("--args") == *argv) | |
jam
2011/03/09 06:33:45
nit: need brace brackets for if statement per guid
| |
32 show_args = true; | |
33 else if (std::string("--ids") == *argv) | |
34 show_ids = true; | |
35 else { | |
36 std::cout << "usage: ipclist [--args] [--ids]" << std::endl; | |
37 return 1; | |
38 } | |
39 } | |
40 | |
41 for (size_t i = 0; i < sizeof(msgtable)/sizeof(msgtable[0]); ++i) { | |
42 std::cout << msgtable[i].name; | |
43 | |
44 if (show_args) | |
45 std::cout << "(" << msgtable[i].in_count << " IN, " << | |
46 msgtable[i].out_count << " OUT)"; | |
47 | |
48 if (show_ids) | |
49 std::cout << " {" << IPC_MESSAGE_ID_CLASS(msgtable[i].id) << ", " << | |
50 IPC_MESSAGE_ID_LINE(msgtable[i].id) << "}"; | |
51 | |
52 std::cout << std::endl; | |
53 } | |
54 | |
55 return 0; | |
56 } | |
OLD | NEW |