Remove Assembly.
[SquirrelJME.git] / modules / cldc-compact / src / main / java / cc / squirreljme / jvm / mle / RuntimeShelf.java
blob7bc7e9ca7ce9552513832ee55223e2d98cde4614
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc.squirreljme.jvm.mle;
12 import cc.squirreljme.jvm.mle.constants.BuiltInEncodingType;
13 import cc.squirreljme.jvm.mle.constants.BuiltInLocaleType;
14 import cc.squirreljme.jvm.mle.constants.ByteOrderType;
15 import cc.squirreljme.jvm.mle.constants.LineEndingType;
16 import cc.squirreljme.jvm.mle.constants.MemoryProfileType;
17 import cc.squirreljme.jvm.mle.constants.PhoneModelType;
18 import cc.squirreljme.jvm.mle.constants.VMDescriptionType;
19 import cc.squirreljme.jvm.mle.constants.VMStatisticType;
20 import cc.squirreljme.jvm.mle.constants.VMType;
21 import cc.squirreljme.jvm.mle.exceptions.MLECallError;
22 import cc.squirreljme.runtime.cldc.annotation.Api;
23 import cc.squirreljme.runtime.cldc.annotation.SquirrelJMEVendorApi;
25 /**
26 * Run-time shelf which contains system information.
28 * @since 2020/06/09
30 @SquirrelJMEVendorApi
31 public final class RuntimeShelf
33 /**
34 * Not used.
36 * @since 2020/06/09
38 private RuntimeShelf()
42 /**
43 * Returns the byte order of the system.
45 * @return The {@link ByteOrderType} of the system.
46 * @since 2021/02/09
48 @SquirrelJMEVendorApi
49 public static native int byteOrder();
51 /**
52 * Returns the current time in milliseconds since UTC.
54 * @return The current time in milliseconds since UTC.
55 * @since 2020/06/18
57 @SquirrelJMEVendorApi
58 public static native long currentTimeMillis();
60 /**
61 * Returns the encoding of the system.
63 * @return The encoding of the system, see {@link BuiltInEncodingType}.
64 * @see BuiltInEncodingType
65 * @since 2020/06/11
67 @SquirrelJMEVendorApi
68 public static native int encoding();
70 /**
71 * Exits the virtual machine.
73 * @param __code The exit code.
74 * @since 2020/06/16
76 @SquirrelJMEVendorApi
77 public static native void exit(int __code);
79 /**
80 * Suggests that garbage collection be done, this may happen now, in
81 * the future, or never as it is not defined.
83 * @since 2021/01/04
85 @SquirrelJMEVendorApi
86 public static native void garbageCollect();
88 /**
89 * Returns the line ending type of the system.
91 * @return The line ending type of the system, see {@link LineEndingType}.
92 * @see LineEndingType
93 * @since 2020/06/09
95 @SquirrelJMEVendorApi
96 public static native int lineEnding();
98 /**
99 * The built-in locate to use.
101 * @return The built-in locale, see {@link BuiltInLocaleType}.
102 * @see BuiltInLocaleType
103 * @since 2020/06/11
105 @SquirrelJMEVendorApi
106 public static native int locale();
109 * The memory profile of the system, should it go out of its way to
110 * conserve extra memory at a performance cost?
112 * @return The {@link MemoryProfileType} of the system.
113 * @since 2021/02/19
115 @SquirrelJMEVendorApi
116 public static native int memoryProfile();
119 * Returns the number of monotonic nanoseconds that have elapsed.
121 * @return The monotonic nanosecond clock.
122 * @since 2020/06/18
124 @SquirrelJMEVendorApi
125 public static native long nanoTime();
128 * Returns the phone model that SquirrelJME is simulating itself as.
130 * @return The {@link PhoneModelType}.
131 * @since 2022/02/14
133 @SquirrelJMEVendorApi
134 public static native int phoneModel();
137 * Returns the value of a system environment variable.
139 * Not every platform and/or system may have these, so these should not
140 * be depended upon.
142 * @param __key The environment variable key.
143 * @return The value of the variable if it is set, otherwise {@code null}.
144 * @throws MLECallError If key is {@code null}.
145 * @since 2023/02/02
147 @SquirrelJMEVendorApi
148 public static native String systemEnv(String __key)
149 throws MLECallError;
152 * Returns the system property for the given key, if there is one.
154 * @param __key The property key.
155 * @return The value of the system property or {@code null}.
156 * @throws MLECallError If {@code __key} is {@code null}.
157 * @since 2020/06/17
159 @SquirrelJMEVendorApi
160 public static native String systemProperty(String __key)
161 throws MLECallError;
164 * Returns a special virtual machine description.
166 * @param __type The {@link VMDescriptionType}.
167 * @return The string for the given description or {@code null} if not
168 * set.
169 * @throws MLECallError If {@code __type} is not valid.
170 * @since 2020/06/17
172 @SquirrelJMEVendorApi
173 public static native String vmDescription(int __type)
174 throws MLECallError;
177 * Returns a statistic of the virtual machine.
179 * @param __type The {@link VMStatisticType}.
180 * @return The value of the statistic, or {@code 0L} if not set.
181 * @throws MLECallError If {@code __type} is not valid.
182 * @since 2020/06/17
184 @SquirrelJMEVendorApi
185 public static native long vmStatistic(int __type)
186 throws MLECallError;
189 * Returns the current {@link VMType}.
191 * @return The current {@link VMType}.
192 * @since 2020/06/16
194 @SquirrelJMEVendorApi
195 public static native int vmType();