2 * Author: Humberto Naves (hsnaves@gmail.com)
16 void print_help (char *prgname
)
20 " %s [-g] [-n nidsfile] [-v] prxfile\n"
22 " -g output graphviz dot\n"
23 " -t print depth first search number\n"
24 " -r print the reverse depth first search number\n"
25 " -d print the dominator\n"
26 " -x print the reverse dominator\n"
27 " -f print the frontier\n"
28 " -z print the reverse frontier\n"
29 " -p print phi functions\n"
30 " -q print code into nodes\n"
31 " -s print structures\n"
32 " -e print edge types\n"
34 " -v increase verbosity\n"
35 " -n specify nids xml file\n"
36 " -i print prx info\n",
41 int main (int argc
, char **argv
)
43 char *prxfilename
= NULL
;
44 char *nidsfilename
= NULL
;
46 int i
, j
, verbosity
= 0;
47 int printgraph
= FALSE
;
48 int printcode
= FALSE
;
49 int printinfo
= FALSE
;
52 struct nidstable
*nids
= NULL
;
56 for (i
= 1; i
< argc
; i
++) {
57 if (strcmp ("--help", argv
[i
]) == 0) {
60 } else if (argv
[i
][0] == '-') {
62 for (j
= 0; s
[j
]; j
++) {
64 case 'v': verbosity
++; break;
65 case 'g': printgraph
= TRUE
; break;
66 case 'c': printcode
= TRUE
; break;
67 case 'i': printinfo
= TRUE
; break;
68 case 't': graphoptions
|= OUT_PRINT_DFS
; break;
69 case 'r': graphoptions
|= OUT_PRINT_RDFS
; break;
70 case 'd': graphoptions
|= OUT_PRINT_DOMINATOR
; break;
71 case 'x': graphoptions
|= OUT_PRINT_RDOMINATOR
; break;
72 case 'f': graphoptions
|= OUT_PRINT_FRONTIER
; break;
73 case 'z': graphoptions
|= OUT_PRINT_RFRONTIER
; break;
74 case 'p': graphoptions
|= OUT_PRINT_PHIS
; break;
75 case 'q': graphoptions
|= OUT_PRINT_CODE
; break;
76 case 's': graphoptions
|= OUT_PRINT_STRUCTURES
; break;
77 case 'e': graphoptions
|= OUT_PRINT_EDGE_TYPES
; break;
80 fatal (__FILE__
": missing nids file");
82 nidsfilename
= argv
[++i
];
87 prxfilename
= argv
[i
];
97 nids
= nids_load (nidsfilename
);
99 p
= prx_load (prxfilename
);
101 fatal (__FILE__
": can't load prx `%s'", prxfilename
);
104 prx_resolve_nids (p
, nids
);
106 if (verbosity
> 2 && nids
&& printinfo
)
109 if (verbosity
> 0 && printinfo
)
110 prx_print (p
, (verbosity
> 1));
112 c
= code_analyse (p
);
114 fatal (__FILE__
": can't analyse code `%s'", prxfilename
);
118 print_graph (c
, prxfilename
, graphoptions
);
121 print_code (c
, prxfilename
);