Skip to content

Commit

Permalink
Implement nqp::getuniname for the JVM backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
peschwa committed Mar 22, 2015
1 parent a7acff6 commit e45d8de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vm/jvm/QAST/Compiler.nqp
Expand Up @@ -2685,6 +2685,8 @@ QAST::OperationsJAST.map_classlib_core_op('nativecallsizeof', $TYPE_NATIVE_OPS,
QAST::OperationsJAST.map_classlib_core_op('nativecallcast', $TYPE_NATIVE_OPS, 'nativecallcast', [$RT_OBJ, $RT_OBJ, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('nativecallglobal', $TYPE_NATIVE_OPS, 'nativecallglobal', [$RT_STR, $RT_STR, $RT_OBJ, $RT_OBJ], $RT_OBJ, :tc);

QAST::OperationsJAST.map_classlib_core_op('getuniname', $TYPE_OPS, 'getuniname', [$RT_INT], $RT_STR, :tc);

class QAST::CompilerJAST {
# Responsible for handling issues around code references, building the
# switch statement dispatcher, etc.
Expand Down
14 changes: 14 additions & 0 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -6191,4 +6191,18 @@ public static SixModelObject jvmgetconfig(ThreadContext tc) {

return res;
}

public static String getuniname(long codePoint, ThreadContext tc) {
String name;
int cp = (int) codePoint;
try {
name = Character.getName(cp);
if(name == null) {
name = "<unassigned>";
}
} catch (IllegalArgumentException iae) {
name = "<illegal>";
}
return name;
}
}

0 comments on commit e45d8de

Please sign in to comment.