| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | package com.sun.fortress.interpreter.glue; |
|---|
| 19 | |
|---|
| 20 | import com.sun.fortress.nodes.Id; |
|---|
| 21 | import com.sun.fortress.nodes.ObjectExpr; |
|---|
| 22 | import com.sun.fortress.nodes.VarDecl; |
|---|
| 23 | import com.sun.fortress.useful.HasAt; |
|---|
| 24 | |
|---|
| 25 | public class WellKnownNames { |
|---|
| 26 | public static final String anyTypeName = "Any"; |
|---|
| 27 | public static final String objectTypeName = "Object"; |
|---|
| 28 | public static final String defaultSelfName = "self"; |
|---|
| 29 | public static final String secretSelfName = "$self"; |
|---|
| 30 | public static final String secretParentName = "$parent"; |
|---|
| 31 | public static String arrayTrait(int rank) { |
|---|
| 32 | return "Array"+rank; |
|---|
| 33 | } |
|---|
| 34 | public static String arrayMaker(int rank) { |
|---|
| 35 | return "__builtinFactory"+rank; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | private static String _fortressLibrary = "FortressLibrary"; |
|---|
| 39 | private static String _fortressBuiltin = "FortressBuiltin"; |
|---|
| 40 | private static String _anyTypeLibrary = "AnyType"; |
|---|
| 41 | private static final String _executableApi = "Executable"; |
|---|
| 42 | private static final String _simpleExecutableApi = "SimpleExecutable"; |
|---|
| 43 | |
|---|
| 44 | private static String[] _defaultLibrary = |
|---|
| 45 | { anyTypeLibrary(), fortressLibrary(), fortressBuiltin() }; |
|---|
| 46 | |
|---|
| 47 | public final static String varargsFactoryName = "__immutableFactory1"; |
|---|
| 48 | public final static String arrayElementTypeName = "T"; |
|---|
| 49 | public final static String arrayGetter = "get"; |
|---|
| 50 | public final static String arrayPutter = "init"; |
|---|
| 51 | |
|---|
| 52 | public final static String matrix = "Matrix"; |
|---|
| 53 | |
|---|
| 54 | public static final String thread = "Thread"; |
|---|
| 55 | |
|---|
| 56 | public final static String loop = "loop"; |
|---|
| 57 | public final static String generate = "__generate"; |
|---|
| 58 | public final static String nest = "__nest"; |
|---|
| 59 | public final static String map = "__map"; |
|---|
| 60 | public final static String singleton = "__singleton"; |
|---|
| 61 | public final static String cond = "__cond"; |
|---|
| 62 | public final static String whileCond = "__whileCond"; |
|---|
| 63 | public final static String bigOperator = "__bigOperator"; |
|---|
| 64 | public final static String bigOperator2 = "__bigOperator2"; |
|---|
| 65 | public final static String filter = "__filter"; |
|---|
| 66 | public final static String outcome = "outcome"; |
|---|
| 67 | |
|---|
| 68 | public final static String containsTypeName = "Contains"; |
|---|
| 69 | public final static String containsMatchName = "MATCH"; |
|---|
| 70 | |
|---|
| 71 | public final static String forbiddenException = "ForbiddenException"; |
|---|
| 72 | public final static String tryatomicFailureException = "TryAtomicFailure"; |
|---|
| 73 | public final static String matchFailureException = "MatchFailure"; |
|---|
| 74 | public final static String callerViolationException = "CallerViolation"; |
|---|
| 75 | public final static String calleeViolationException = "CalleeViolation"; |
|---|
| 76 | public final static String labelException = "LabelException"; |
|---|
| 77 | |
|---|
| 78 | public static String fortressLibrary() { return _fortressLibrary; } |
|---|
| 79 | public static String fortressBuiltin() { return _fortressBuiltin; } |
|---|
| 80 | public static String anyTypeLibrary() { return _anyTypeLibrary; } |
|---|
| 81 | public static String[] defaultLibrary() { return _defaultLibrary; } |
|---|
| 82 | |
|---|
| 83 | public static boolean exportsMain(String apiName) { |
|---|
| 84 | return (apiName.equals(_executableApi) || apiName.equals(_simpleExecutableApi)); |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | public static void useCompilerLibraries() { |
|---|
| 92 | _fortressLibrary = "CompilerLibrary"; |
|---|
| 93 | _fortressBuiltin = "CompilerBuiltin"; |
|---|
| 94 | _defaultLibrary = |
|---|
| 95 | new String[] { anyTypeLibrary(), fortressLibrary(), fortressBuiltin() }; |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | public final static String obfuscatedSingletonConstructorName(String fname, HasAt x) { |
|---|
| 99 | |
|---|
| 100 | return "*1_" + fname; |
|---|
| 101 | } |
|---|
| 102 | public static String objectExprName(ObjectExpr expr) { |
|---|
| 103 | return "*objectexpr_" + expr.toString(); |
|---|
| 104 | } |
|---|
| 105 | public static String tempTupleName(VarDecl vd) { |
|---|
| 106 | |
|---|
| 107 | return "*tuple_"+vd.at(); |
|---|
| 108 | } |
|---|
| 109 | public static String tempForUnderscore(Id id) { |
|---|
| 110 | |
|---|
| 111 | return "*underscore_"+id.at(); |
|---|
| 112 | } |
|---|
| 113 | |
|---|
| 114 | } |
|---|