1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.jvm
;
13 * This interface contains the various error codes for all of the system calls.
17 public final class SystemCallError
19 /** No error, or success. */
20 public static final byte NO_ERROR
=
23 /** The system call is not supported. */
24 public static final byte UNSUPPORTED_SYSTEM_CALL
=
27 /** The pipe descriptor is not valid. */
28 public static final byte PIPE_DESCRIPTOR_INVALID
=
31 /** Write error when writing to the pipe. */
32 public static final byte PIPE_DESCRIPTOR_BAD_WRITE
=
35 /** Value out of range. */
36 public static final byte VALUE_OUT_OF_RANGE
=
39 /** No frame buffer exists. */
40 public static final byte NO_FRAMEBUFFER
=
43 /** Permission denied. */
44 public static final byte PERMISSION_DENIED
=
48 public static final byte INTERRUPTED
=
52 public static final byte UNKNOWN
=
55 /** End of file reached. */
56 public static final byte END_OF_FILE
=
59 /** Error with IPC Call. */
60 public static final byte IPC_ERROR
=
64 public static final byte NO_SUCH_CLASS
=
67 /** No such thread exists. */
68 public static final byte NO_SUCH_THREAD
=
71 /** Thread already has a context. */
72 public static final byte THREAD_HAS_CONTEXT
=
75 /** No such configuration key. */
76 public static final byte NO_SUCH_CONFIG_KEY
=
79 /** Invalid memory handle kind. */
80 public static final byte INVALID_MEMHANDLE_KIND
=
83 /** Could not flush the pipe. */
84 public static final byte PIPE_DESCRIPTOR_BAD_FLUSH
=
92 private SystemCallError()
97 * Converts the error to a string.
99 * @param __err The input error.
100 * @return The resulting string.
103 public static String
toString(int __err
)
107 case SystemCallError
.NO_ERROR
:
110 case SystemCallError
.UNSUPPORTED_SYSTEM_CALL
:
111 return "UnsupportedSystemCall";
113 case SystemCallError
.PIPE_DESCRIPTOR_INVALID
:
116 case SystemCallError
.PIPE_DESCRIPTOR_BAD_WRITE
:
119 case SystemCallError
.VALUE_OUT_OF_RANGE
:
120 return "ValueOutOfRange";
122 case SystemCallError
.NO_FRAMEBUFFER
:
123 return "NoFramebuffer";
125 case SystemCallError
.PERMISSION_DENIED
:
126 return "PermissionDenied";
128 case SystemCallError
.INTERRUPTED
:
129 return "Interrupted";
131 case SystemCallError
.UNKNOWN
:
134 case SystemCallError
.END_OF_FILE
:
137 case SystemCallError
.IPC_ERROR
:
140 case SystemCallError
.NO_SUCH_CLASS
:
141 return "NoSuchClass";
143 case SystemCallError
.NO_SUCH_THREAD
:
144 return "NoSuchThread";
146 case SystemCallError
.THREAD_HAS_CONTEXT
:
147 return "ThreadHasContext";
149 case SystemCallError
.NO_SUCH_CONFIG_KEY
:
150 return "NoSuchConfigKey";
154 return "ERROR" + __err
;