d302d3c2f7e1f8afa61e73c2e63c66db55d3fdc9
[ctsim.git] / include / trace.h
1 #ifndef TRACE_H
2 #define TRACE_H
3
4 // Trace levels
5 static const char TRACE_NONE_STR[]=     "none";
6 static const char TRACE_TEXT_STR[]=     "text";
7 static const char TRACE_PHM_STR[]=      "phm";
8 static const char TRACE_RAYS_STR[]=     "rays";
9 static const char TRACE_PLOT_STR[]=     "plot";
10 static const char TRACE_CLIPPING_STR[]= "clipping";
11
12 enum {
13   TRACE_NONE,           /* No tracing */
14   TRACE_TEXT,           /* Minimal status */
15   TRACE_PHM,            /* Show phantom */
16   TRACE_RAYS,           /* Show all rays */
17   TRACE_PLOT,           /* Plot raysums */
18   TRACE_CLIPPING        /* Plot clipping */
19 };
20
21 inline int 
22 opt_set_trace (const char *optarg)
23 {
24   int opt;
25
26   if (strcmp(optarg, TRACE_NONE_STR) == 0)
27     opt = TRACE_NONE;
28   else if (strcmp(optarg, TRACE_TEXT_STR) == 0)
29     opt = TRACE_TEXT;
30   else if (strcmp(optarg, TRACE_PHM_STR) == 0)
31     opt = TRACE_PHM;
32   else if (strcmp(optarg, TRACE_PLOT_STR) == 0)
33     opt = TRACE_PLOT;
34   else if (strcmp(optarg, TRACE_CLIPPING_STR) == 0)
35     opt = TRACE_CLIPPING;
36   else if (strcmp(optarg, TRACE_RAYS_STR) == 0)
37     opt = TRACE_RAYS;
38   else {
39     sys_error(ERR_WARNING,"Invalid trace option %s\n", optarg);
40     opt = -1;
41   }
42
43   return (opt);
44 }
45
46
47 #endif
48