r117: *** empty log message ***
[ctsim.git] / include / trace.h
diff --git a/include/trace.h b/include/trace.h
new file mode 100644 (file)
index 0000000..d302d3c
--- /dev/null
@@ -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
+