mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
WASM: add support of Character.toLowerCase/toUpperCase. Add _ prefix to names in c output
This commit is contained in:
parent
558bcf1137
commit
0a00551af1
|
@ -16,6 +16,8 @@
|
|||
package org.teavm.classlib.java.lang;
|
||||
|
||||
import org.teavm.classlib.impl.unicode.UnicodeHelper;
|
||||
import org.teavm.interop.DelegateTo;
|
||||
import org.teavm.interop.Import;
|
||||
import org.teavm.platform.Platform;
|
||||
import org.teavm.platform.metadata.MetadataProvider;
|
||||
import org.teavm.platform.metadata.StringResource;
|
||||
|
@ -231,18 +233,34 @@ public class TCharacter extends TObject implements TComparable<TCharacter> {
|
|||
return (char) toLowerCase((int) ch);
|
||||
}
|
||||
|
||||
@DelegateTo("toLowerCaseLowLevel")
|
||||
public static int toLowerCase(int ch) {
|
||||
return Platform.stringFromCharCode(ch).toLowerCase().charCodeAt(0);
|
||||
}
|
||||
|
||||
private static int toLowerCaseLowLevel(int codePoint) {
|
||||
return toLowerCaseSystem(codePoint);
|
||||
}
|
||||
|
||||
@Import(module = "runtime", name = "towlower")
|
||||
private static native int toLowerCaseSystem(int codePoint);
|
||||
|
||||
public static char toUpperCase(char ch) {
|
||||
return (char) toUpperCase((int) ch);
|
||||
}
|
||||
|
||||
@DelegateTo("toUpperCaseLowLevel")
|
||||
public static int toUpperCase(int codePoint) {
|
||||
return Platform.stringFromCharCode(codePoint).toUpperCase().charCodeAt(0);
|
||||
}
|
||||
|
||||
private static int toUpperCaseLowLevel(int codePoint) {
|
||||
return toUpperCaseSystem(codePoint);
|
||||
}
|
||||
|
||||
@Import(module = "runtime", name = "towupper")
|
||||
private static native int toUpperCaseSystem(int codePoint);
|
||||
|
||||
public static int digit(char ch, int radix) {
|
||||
return digit((int) ch, radix);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class WasmCRenderer {
|
|||
|
||||
for (WasmFunction function : module.getFunctions().values()) {
|
||||
if (function.getExportName() != null && function.getExportName().equals("main")) {
|
||||
line(function.getName() + "(0);");
|
||||
line(function.getName() + "(1);");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1049,7 +1049,7 @@ class WasmCRenderingVisitor implements WasmExpressionVisitor {
|
|||
String result = localVariableNames[local.getIndex()];
|
||||
if (result == null) {
|
||||
if (local.getName() != null) {
|
||||
result = local.getName();
|
||||
result = "_" + local.getName();
|
||||
} else {
|
||||
result = "localVar" + local.getIndex();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user