Add vendor API to software math.
[SquirrelJME.git] / modules / cldc-compact / src / main / java / cc / squirreljme / jvm / mle / RuntimeShelf.java
blob0014563b5aad2fbd82d32e5635343e1d034309b0
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;
24 /**
25 * Run-time shelf which contains system information.
27 * @since 2020/06/09
29 @SquirrelJMEVendorApi
30 public final class RuntimeShelf
32 /**
33 * Not used.
35 * @since 2020/06/09
37 private RuntimeShelf()
41 /**
42 * Returns the byte order of the system.
44 * @return The {@link ByteOrderType} of the system.
45 * @since 2021/02/09
47 @SquirrelJMEVendorApi
48 public static native int byteOrder();
50 /**
51 * Returns the current time in milliseconds since UTC.
53 * @return The current time in milliseconds since UTC.
54 * @since 2020/06/18
56 @SquirrelJMEVendorApi
57 public static native long currentTimeMillis();
59 /**
60 * Returns the encoding of the system.
62 * @return The encoding of the system, see {@link BuiltInEncodingType}.
63 * @see BuiltInEncodingType
64 * @since 2020/06/11
66 @SquirrelJMEVendorApi
67 public static native int encoding();
69 /**
70 * Exits the virtual machine.
72 * @param __code The exit code.
73 * @since 2020/06/16
75 @SquirrelJMEVendorApi
76 public static native void exit(int __code);
78 /**
79 * Suggests that garbage collection be done, this may happen now, in
80 * the future, or never as it is not defined.
82 * @since 2021/01/04
84 @SquirrelJMEVendorApi
85 public static native void garbageCollect();
87 /**
88 * Returns the line ending type of the system.
90 * @return The line ending type of the system, see {@link LineEndingType}.
91 * @see LineEndingType
92 * @since 2020/06/09
94 @SquirrelJMEVendorApi
95 public static native int lineEnding();
97 /**
98 * The built-in locate to use.
100 * @return The built-in locale, see {@link BuiltInLocaleType}.
101 * @see BuiltInLocaleType
102 * @since 2020/06/11
104 @SquirrelJMEVendorApi
105 public static native int locale();
108 * The memory profile of the system, should it go out of its way to
109 * conserve extra memory at a performance cost?
111 * @return The {@link MemoryProfileType} of the system.
112 * @since 2021/02/19
114 @SquirrelJMEVendorApi
115 public static native int memoryProfile();
118 * Returns the number of monotonic nanoseconds that have elapsed.
120 * @return The monotonic nanosecond clock.
121 * @since 2020/06/18
123 @SquirrelJMEVendorApi
124 public static native long nanoTime();
127 * Returns the phone model that SquirrelJME is simulating itself as.
129 * @return The {@link PhoneModelType}.
130 * @since 2022/02/14
132 @SquirrelJMEVendorApi
133 public static native int phoneModel();
136 * Returns the value of a system environment variable.
138 * Not every platform and/or system may have these, so these should not
139 * be depended upon.
141 * @param __key The environment variable key.
142 * @return The value of the variable if it is set, otherwise {@code null}.
143 * @throws MLECallError If key is {@code null}.
144 * @since 2023/02/02
146 @SquirrelJMEVendorApi
147 public static native String systemEnv(String __key)
148 throws MLECallError;
151 * Returns the system property for the given key, if there is one.
153 * @param __key The property key.
154 * @return The value of the system property or {@code null}.
155 * @throws MLECallError If {@code __key} is {@code null}.
156 * @since 2020/06/17
158 @SquirrelJMEVendorApi
159 public static native String systemProperty(String __key)
160 throws MLECallError;
163 * Returns a special virtual machine description.
165 * @param __type The {@link VMDescriptionType}.
166 * @return The string for the given description or {@code null} if not
167 * set.
168 * @throws MLECallError If {@code __type} is not valid.
169 * @since 2020/06/17
171 @SquirrelJMEVendorApi
172 public static native String vmDescription(int __type)
173 throws MLECallError;
176 * Returns a statistic of the virtual machine.
178 * @param __type The {@link VMStatisticType}.
179 * @return The value of the statistic, or {@code 0L} if not set.
180 * @throws MLECallError If {@code __type} is not valid.
181 * @since 2020/06/17
183 @SquirrelJMEVendorApi
184 public static native long vmStatistic(int __type)
185 throws MLECallError;
188 * Returns the current {@link VMType}.
190 * @return The current {@link VMType}.
191 * @since 2020/06/16
193 @SquirrelJMEVendorApi
194 public static native int vmType();