summaryrefslogtreecommitdiff
path: root/src/runtime/c/teyjus/system/message.h
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2012-07-31 15:16:04 +0000
committerkr.angelov <kr.angelov@gmail.com>2012-07-31 15:16:04 +0000
commit83b321d862472f31c0c9f7feca8360ad5bfe8a75 (patch)
tree0f0ef20ad78e25b320013c7bb160211a8612d4e9 /src/runtime/c/teyjus/system/message.h
parent314662dd09d5d1480007faa79258b0e93cc2aa59 (diff)
An initial import of the teyjus source code in the C runtime for GF. The two runtime are still not connected but the source code compiles.
Diffstat (limited to 'src/runtime/c/teyjus/system/message.h')
-rw-r--r--src/runtime/c/teyjus/system/message.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/runtime/c/teyjus/system/message.h b/src/runtime/c/teyjus/system/message.h
new file mode 100644
index 000000000..cf0fa00fd
--- /dev/null
+++ b/src/runtime/c/teyjus/system/message.h
@@ -0,0 +1,76 @@
+//////////////////////////////////////////////////////////////////////////////
+//Copyright 2008
+// Andrew Gacek, Steven Holte, Gopalan Nadathur, Xiaochu Qi, Zach Snow
+//////////////////////////////////////////////////////////////////////////////
+// This file is part of Teyjus. //
+// //
+// Teyjus is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// Teyjus is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with Teyjus. If not, see <http://www.gnu.org/licenses/>. //
+//////////////////////////////////////////////////////////////////////////////
+/****************************************************************************
+ * *
+ * File message.h -- code to present messages to the user in Teyjus. *
+ * supports dynamically adding "%x"-style formatting switches, as well as *
+ * complete support for simply making separate builds. *
+ * *
+ ****************************************************************************/
+
+#ifndef MESSAGE_H
+#define MESSAGE_H
+
+#include <stdarg.h>
+#include "../simulator/mctypes.h"
+
+/****************************************************************************
+ * Type of a function to handle a particular formatting switch. *
+ ****************************************************************************/
+/* these functions should increment ioArgument as necessary. */
+typedef void (*MSG_SwitchFunction)(char *inSwitch, WordPtr inStream,
+ va_list *ioArgument);
+
+
+/****************************************************************************
+ * Type of a block of messages, with associated constants. *
+ ****************************************************************************/
+typedef struct MSG_Msg
+{
+ int mIndex; /* Index of this error message */
+ int mPreChain; /* Index of message to print before this one */
+ char *mMessage; /* The message itself */
+ int mPostChain; /* Index of message to print after this one */
+
+ int mExnType; /* if MSG_NO_EXN, MSG_Error() will return */
+ unsigned int mExitStatus; /* value to return with abort() */
+} MSG_Msg;
+
+typedef struct MSG_MessageBlock
+{
+ int mCount; /* No. of messages in this block */
+ int mMinIndex, mMaxIndex; /* mMinIndex <= every index <= mMaxIndex */
+ struct MSG_MessageBlock *mNext; /* Next block of messages in linked list */
+ MSG_Msg *mMessages; /* Array of messages */
+} MSG_MessageBlock;
+
+/****************************************************************************
+ * Initialization functions *
+ ****************************************************************************/
+void MSG_addSwitch(char inSwitch, MSG_SwitchFunction inFunction);
+void MSG_addMessages(int inCount, MSG_Msg *inMessages);
+
+/****************************************************************************
+ * The routine that gets called to print a message, returning the exception *
+ * type for the error message (mExnType) *
+ ****************************************************************************/
+int MSG_vMessage(int inIndex, va_list *ap);
+
+#endif /* MESSAGE_H */