X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=include%2Ftrace.h;fp=include%2Ftrace.h;h=d302d3c2f7e1f8afa61e73c2e63c66db55d3fdc9;hb=2d39e823ba389fc68e5317c422b55be006094252;hp=0000000000000000000000000000000000000000;hpb=a95e41ac40cd2f3a4401d921618604cf33f2a904;p=ctsim.git diff --git a/include/trace.h b/include/trace.h new file mode 100644 index 0000000..d302d3c --- /dev/null +++ b/include/trace.h @@ -0,0 +1,48 @@ +#ifndef TRACE_H +#define TRACE_H + +// Trace levels +static const char TRACE_NONE_STR[]= "none"; +static const char TRACE_TEXT_STR[]= "text"; +static const char TRACE_PHM_STR[]= "phm"; +static const char TRACE_RAYS_STR[]= "rays"; +static const char TRACE_PLOT_STR[]= "plot"; +static const char TRACE_CLIPPING_STR[]= "clipping"; + +enum { + TRACE_NONE, /* No tracing */ + TRACE_TEXT, /* Minimal status */ + TRACE_PHM, /* Show phantom */ + TRACE_RAYS, /* Show all rays */ + TRACE_PLOT, /* Plot raysums */ + TRACE_CLIPPING /* Plot clipping */ +}; + +inline int +opt_set_trace (const char *optarg) +{ + int opt; + + if (strcmp(optarg, TRACE_NONE_STR) == 0) + opt = TRACE_NONE; + else if (strcmp(optarg, TRACE_TEXT_STR) == 0) + opt = TRACE_TEXT; + else if (strcmp(optarg, TRACE_PHM_STR) == 0) + opt = TRACE_PHM; + else if (strcmp(optarg, TRACE_PLOT_STR) == 0) + opt = TRACE_PLOT; + else if (strcmp(optarg, TRACE_CLIPPING_STR) == 0) + opt = TRACE_CLIPPING; + else if (strcmp(optarg, TRACE_RAYS_STR) == 0) + opt = TRACE_RAYS; + else { + sys_error(ERR_WARNING,"Invalid trace option %s\n", optarg); + opt = -1; + } + + return (opt); +} + + +#endif +