summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/common.hh
diff options
context:
space:
mode:
Diffstat (limited to 'tiger-compiler/src/common.hh')
-rw-r--r--tiger-compiler/src/common.hh49
1 files changed, 49 insertions, 0 deletions
diff --git a/tiger-compiler/src/common.hh b/tiger-compiler/src/common.hh
new file mode 100644
index 0000000..ca647a9
--- /dev/null
+++ b/tiger-compiler/src/common.hh
@@ -0,0 +1,49 @@
+/**
+ ** \file src/common.hh
+ ** \brief Definitions common to the whole task system.
+ **
+ ** These variables are global. As such they should not be used
+ ** in the libraries, but only in the "imperative" subsystem: the
+ ** tasks.
+ */
+
+#pragma once
+
+#include <misc/error.hh>
+#include <misc/timer.hh>
+
+#ifdef SWIG
+// Warning 451: Setting a const char * variable may leak memory.
+%warnfilter(451) program_name;
+%warnfilter(451) program_version;
+%warnfilter(451) program_bug_address;
+%warnfilter(451) program_doc;
+%warnfilter(451) program_args_doc;
+%warnfilter(451) filename;
+#endif /* ! SWIG */
+
+/// \name Program identity.
+/// \{
+/// Name of this program.
+extern const char* program_name;
+
+/// Version string of this program.
+extern const char* program_version;
+
+/// Bug report address of this program.
+extern const char* program_bug_address;
+
+/// Describe program and accepted arguments.
+extern const char* program_doc;
+extern const char* program_args_doc;
+
+/// \}
+
+/// Timing the tasks.
+extern misc::timer task_timer;
+
+/// Sole argument: the file to process.
+extern const char* filename;
+
+/// The current state of error.
+extern misc::error& task_error();