| 1 | (******************************************************************************* |
|---|
| 2 | Copyright 2009 Sun Microsystems, Inc., |
|---|
| 3 | 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
|---|
| 4 | All rights reserved. |
|---|
| 5 | |
|---|
| 6 | U.S. Government Rights - Commercial software. |
|---|
| 7 | Government users are subject to the Sun Microsystems, Inc. standard |
|---|
| 8 | license agreement and applicable provisions of the FAR and its supplements. |
|---|
| 9 | |
|---|
| 10 | Use is subject to license terms. |
|---|
| 11 | |
|---|
| 12 | This distribution may include materials developed by third parties. |
|---|
| 13 | |
|---|
| 14 | Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered |
|---|
| 15 | trademarks of Sun Microsystems, Inc. in the U.S. and other countries. |
|---|
| 16 | ******************************************************************************) |
|---|
| 17 | |
|---|
| 18 | native component FortressBuiltin |
|---|
| 19 | export FortressBuiltin |
|---|
| 20 | |
|---|
| 21 | private language="java" |
|---|
| 22 | private package="com.sun.fortress.interpreter.glue.prim" |
|---|
| 23 | |
|---|
| 24 | (** The %builtinPrimitive% function is actually recognized as a special piece |
|---|
| 25 | of built-in magic by the Fortress interpreter. The %javaClass% |
|---|
| 26 | argument names a Java Class which is a subclass of |
|---|
| 27 | \texttt{com.sun.fortress.interpreter.glue.NativeApp}, which provides code |
|---|
| 28 | for the closure which is used in place of the call to |
|---|
| 29 | %builtinPrimitive%. Meanwhile all the necessary type information, |
|---|
| 30 | argument names, etc. must be declared here in Fortress-land. For |
|---|
| 31 | examples, see the end of this file. |
|---|
| 32 | |
|---|
| 33 | In practice, if you are extending the interpreter you will probably |
|---|
| 34 | want to extend \texttt{com.sun.fortress.interpreter.glue.NativeFn0,1,2,3,4} |
|---|
| 35 | or one of their subclasses defined in |
|---|
| 36 | \texttt{com.sun.fortress.interpreter.glue.primitive}. These types are |
|---|
| 37 | generally easier to work with, and the boilerplate packing and |
|---|
| 38 | unpacking of values is done for you. |
|---|
| 39 | **) |
|---|
| 40 | builtinPrimitive[\T\](javaClass:String):T = |
|---|
| 41 | fail ("Implementation should not invoke builtinPrimitive " javaClass) |
|---|
| 42 | |
|---|
| 43 | trait Object extends Any |
|---|
| 44 | getter ilkName(): String = |
|---|
| 45 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.ObjectPrims$ClassName") |
|---|
| 46 | getter asString(): String = |
|---|
| 47 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.ObjectPrims$ToString") |
|---|
| 48 | getter asDebugString(): String = do (* for debugging; may contain more information *) |
|---|
| 49 | ilk = self.ilkName |
|---|
| 50 | first = ilk[0] |
|---|
| 51 | article = if first = 'a' OR: first = 'e' OR: first = 'i' OR: first = 'o' then "an " else "a " end |
|---|
| 52 | article ilk ": " self.asString |
|---|
| 53 | end |
|---|
| 54 | getter asExprString(): String |
|---|
| 55 | = "no expression for " self.asString |
|---|
| 56 | |
|---|
| 57 | getter toString(): String = self.asString (* deprecated *) |
|---|
| 58 | end |
|---|
| 59 | |
|---|
| 60 | value object Float extends RR64 |
|---|
| 61 | getter asString(): String = |
|---|
| 62 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$ToString") |
|---|
| 63 | getter asExprString(): String = |
|---|
| 64 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$ToString") |
|---|
| 65 | (** returns true if the value is an IEEE NaN **) |
|---|
| 66 | getter isNaN(): Boolean = |
|---|
| 67 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$isNaN") |
|---|
| 68 | (** returns true if the value is an IEEE infinity **) |
|---|
| 69 | getter isInfinite(): Boolean = |
|---|
| 70 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$isInfinite") |
|---|
| 71 | (** obtain the raw bits of the IEEE floating-point representation of this value. **) |
|---|
| 72 | getter rawBits():ZZ64 = |
|---|
| 73 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$RawBits") |
|---|
| 74 | getter signBit():ZZ32 = if self.rawBits < 0 then 1 else 0 end |
|---|
| 75 | (** next higher IEEE float **) |
|---|
| 76 | getter nextUp():RR64 = |
|---|
| 77 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$NextUp") |
|---|
| 78 | (** next lower IEEE float **) |
|---|
| 79 | getter nextDown():RR64 = |
|---|
| 80 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$NextDown") |
|---|
| 81 | asFloat(self): Float = self |
|---|
| 82 | (** returns a value of type RR32 **) |
|---|
| 83 | narrow(self): RR32 = |
|---|
| 84 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Narrow") |
|---|
| 85 | opr |self| : Number = |
|---|
| 86 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Abs") |
|---|
| 87 | opr =(self, b:Float):Boolean = |
|---|
| 88 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Eq") |
|---|
| 89 | opr =/=(self, b:Float):Boolean = |
|---|
| 90 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$NEq") |
|---|
| 91 | opr <(self, b:Float):Boolean = |
|---|
| 92 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Less") |
|---|
| 93 | opr <=(self, b:Float):Boolean = |
|---|
| 94 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$LessEq") |
|---|
| 95 | opr >(self, b:Float):Boolean = |
|---|
| 96 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Greater") |
|---|
| 97 | opr >=(self, b:Float):Boolean = |
|---|
| 98 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$GreaterEq") |
|---|
| 99 | (** In case of NaN, %MIN% and %MAX% return a NaN, otherwise it respects the |
|---|
| 100 | total order. **) |
|---|
| 101 | opr MIN(self, b:Float):Number = |
|---|
| 102 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Min") |
|---|
| 103 | opr MAX(self, b:Float):Number = |
|---|
| 104 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Max") |
|---|
| 105 | opr MINMAX(self, b:Float): Number = (self MIN b, self MAX b) |
|---|
| 106 | |
|---|
| 107 | opr -(self):RR64 = |
|---|
| 108 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Negate") |
|---|
| 109 | opr +(self,b:Float):RR64 = |
|---|
| 110 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Add") |
|---|
| 111 | opr -(self,b:Float):RR64 = |
|---|
| 112 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Sub") |
|---|
| 113 | opr DOT(self,b:Float):RR64 = |
|---|
| 114 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Mul") |
|---|
| 115 | opr TIMES(self,b:Float):RR64 = |
|---|
| 116 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Mul") |
|---|
| 117 | opr juxtaposition |
|---|
| 118 | (self,b:Float):RR64 = |
|---|
| 119 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Mul") |
|---|
| 120 | opr /(self,b:Float):RR64 = |
|---|
| 121 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Div") |
|---|
| 122 | opr SQRT(self):RR64 = |
|---|
| 123 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Sqrt") |
|---|
| 124 | opr PLUS_UP(self,b:Float):RR64 = |
|---|
| 125 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$AddUpNoNaN") |
|---|
| 126 | opr MINUS_UP(self,b:Float):RR64 = |
|---|
| 127 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$SubUpNoNaN") |
|---|
| 128 | opr DOT_UP(self,b:Float):RR64 = |
|---|
| 129 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$MulUpNoNaN") |
|---|
| 130 | opr SLASH_UP(self,b:Float):RR64 = |
|---|
| 131 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$DivUpNoNaN") |
|---|
| 132 | opr SQRT_UP(self):RR64 = |
|---|
| 133 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$SqrtUp") |
|---|
| 134 | opr PLUS_DOWN(self,b:Float):RR64 = |
|---|
| 135 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$AddDownNoNaN") |
|---|
| 136 | opr MINUS_DOWN(self,b:Float):RR64 = |
|---|
| 137 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$SubDownNoNaN") |
|---|
| 138 | opr DOT_DOWN(self,b:Float):RR64 = |
|---|
| 139 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$MulDownNoNaN") |
|---|
| 140 | opr SLASH_DOWN(self,b:Float):RR64 = |
|---|
| 141 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$DivDownNoNaN") |
|---|
| 142 | opr SQRT_DOWN(self):RR64 = |
|---|
| 143 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$SqrtDown") |
|---|
| 144 | opr IEEE_PLUS_UP(self,b:Float):RR64 = |
|---|
| 145 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$AddUp") |
|---|
| 146 | opr IEEE_MINUS_UP(self,b:Float):RR64 = |
|---|
| 147 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$SubUp") |
|---|
| 148 | opr IEEE_DOT_UP(self,b:Float):RR64 = |
|---|
| 149 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$MulUp") |
|---|
| 150 | opr IEEE_SLASH_UP(self,b:Float):RR64 = |
|---|
| 151 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$DivUp") |
|---|
| 152 | opr IEEE_PLUS_DOWN(self,b:Float):RR64 = |
|---|
| 153 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$AddDown") |
|---|
| 154 | opr IEEE_MINUS_DOWN(self,b:Float):RR64 = |
|---|
| 155 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$SubDown") |
|---|
| 156 | opr IEEE_DOT_DOWN(self,b:Float):RR64 = |
|---|
| 157 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$MulDown") |
|---|
| 158 | opr IEEE_SLASH_DOWN(self,b:Float):RR64 = |
|---|
| 159 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$DivDown") |
|---|
| 160 | opr ^(self, b:Float):RR64 = |
|---|
| 161 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Pow") |
|---|
| 162 | opr ^(self, b:RR32):RR64 = |
|---|
| 163 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Pow") |
|---|
| 164 | opr ^(self, b:Number):RR64 = self^(asFloat(b)) |
|---|
| 165 | (** Shouldn't need this extra declaration. **) |
|---|
| 166 | opr ^(self, b:AnyIntegral):RR64 = |
|---|
| 167 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Pow") |
|---|
| 168 | sin(self):RR64 = |
|---|
| 169 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Sin") |
|---|
| 170 | cos(self):RR64 = |
|---|
| 171 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Cos") |
|---|
| 172 | tan(self):RR64 = |
|---|
| 173 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Tan") |
|---|
| 174 | asin(self):RR64 = |
|---|
| 175 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$ASin") |
|---|
| 176 | acos(self):RR64 = |
|---|
| 177 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$ACos") |
|---|
| 178 | atan(self):RR64 = |
|---|
| 179 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$ATan") |
|---|
| 180 | atan2(self,x:Number):RR64 = |
|---|
| 181 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$ATan2") |
|---|
| 182 | log(self):RR64 = |
|---|
| 183 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Log") |
|---|
| 184 | exp(self):RR64 = |
|---|
| 185 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Exp") |
|---|
| 186 | floor(self):RR64 = |
|---|
| 187 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Floor") |
|---|
| 188 | opr |\self/| : ZZ64 = |
|---|
| 189 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$IFloor") |
|---|
| 190 | ceiling(self):RR64 = |
|---|
| 191 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Ceiling") |
|---|
| 192 | opr |/self\| : ZZ64 = |
|---|
| 193 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$ICeiling") |
|---|
| 194 | truncate(self):ZZ64 = |
|---|
| 195 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Truncate") |
|---|
| 196 | round(self):ZZ64 = |
|---|
| 197 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Round") |
|---|
| 198 | end |
|---|
| 199 | |
|---|
| 200 | object FloatLiteral extends RR64 |
|---|
| 201 | getter asString(): String = |
|---|
| 202 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.FloatLiteral$ToString") |
|---|
| 203 | getter asExprString(): String = |
|---|
| 204 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.FloatLiteral$ToString") |
|---|
| 205 | asFloat(self): Float = |
|---|
| 206 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.FloatLiteral$AsFloat") |
|---|
| 207 | end |
|---|
| 208 | |
|---|
| 209 | value object RR32 extends RR64 |
|---|
| 210 | getter zero(): Number = narrow(0.0) |
|---|
| 211 | getter one(): Number = narrow(1.0) |
|---|
| 212 | getter asString(): String = |
|---|
| 213 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$ToString") |
|---|
| 214 | getter asExprString(): String = |
|---|
| 215 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$ToString") |
|---|
| 216 | |
|---|
| 217 | (** returns true if the value is an IEEE NaN **) |
|---|
| 218 | getter isNaN(): Boolean = |
|---|
| 219 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$isNaN") |
|---|
| 220 | (** returns true if the value is an IEEE infinity **) |
|---|
| 221 | getter isInfinite(): Boolean = |
|---|
| 222 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$isInfinite") |
|---|
| 223 | (** returns true if the value is a valid number (not NaN) **) |
|---|
| 224 | getter isNumber(): Boolean = NOT self.isNaN |
|---|
| 225 | (** returns true if the value is finite **) |
|---|
| 226 | getter isFinite(): Boolean = NOT (self.isInfinite OR self.isNaN) |
|---|
| 227 | (** check returns Just(its argument) if it is finite, otherwise Nothing. **) |
|---|
| 228 | getter check(): Maybe[\RR32\] = |
|---|
| 229 | if self.isFinite then Just[\RR32\](self) else Nothing[\RR32\] end |
|---|
| 230 | (** check_star returns Just(its argument) if it is non-NaN, otherwise Nothing. **) |
|---|
| 231 | getter check_star(): Maybe[\RR32\] = |
|---|
| 232 | if self.isNaN then Nothing[\RR32\] else Just[\RR32\](self) end |
|---|
| 233 | (** obtain the raw bits of the IEEE floating-point representation of this value. **) |
|---|
| 234 | getter rawBits():ZZ32 = |
|---|
| 235 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$RawBits") |
|---|
| 236 | getter signBit():ZZ32 = if self.rawBits < 0 then 1 else 0 end |
|---|
| 237 | (** next higher IEEE float **) |
|---|
| 238 | getter nextUp():RR32 = |
|---|
| 239 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$NextUp") |
|---|
| 240 | (** next lower IEEE float **) |
|---|
| 241 | getter nextDown():RR32 = |
|---|
| 242 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$NextDown") |
|---|
| 243 | |
|---|
| 244 | asFloat(self): Float = |
|---|
| 245 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$AsFloat") |
|---|
| 246 | |
|---|
| 247 | opr |self| : Number = |
|---|
| 248 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Abs") |
|---|
| 249 | opr =(self, b:Number):Boolean = |
|---|
| 250 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Eq") |
|---|
| 251 | opr =/=(self, b:Number):Boolean = |
|---|
| 252 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$NEq") |
|---|
| 253 | opr <(self, b:Number):Boolean = |
|---|
| 254 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Less") |
|---|
| 255 | opr <=(self, b:Number):Boolean = |
|---|
| 256 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$LessEq") |
|---|
| 257 | opr >(self, b:Number):Boolean = |
|---|
| 258 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Greater") |
|---|
| 259 | opr >=(self, b:Number):Boolean = |
|---|
| 260 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$GreaterEq") |
|---|
| 261 | opr CMP(self, b:Number):Comparison = |
|---|
| 262 | if self<b then LessThan |
|---|
| 263 | elif self>b then GreaterThan |
|---|
| 264 | elif self=b then EqualTo |
|---|
| 265 | else Unordered |
|---|
| 266 | end |
|---|
| 267 | (** In case of NaN, %MIN% and %MAX% return a NaN, otherwise it respects the |
|---|
| 268 | total order. **) |
|---|
| 269 | opr MIN(self, b:Number):Number = |
|---|
| 270 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Min") |
|---|
| 271 | opr MAX(self, b:Number):Number = |
|---|
| 272 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Max") |
|---|
| 273 | opr MINMAX(self, b:Number): Number = |
|---|
| 274 | (self MIN b, self MAX b) |
|---|
| 275 | |
|---|
| 276 | opr -(self):RR32 = |
|---|
| 277 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Negate") |
|---|
| 278 | opr +(self,b:Number):RR32 = |
|---|
| 279 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Add") |
|---|
| 280 | opr -(self,b:Number):RR32 = |
|---|
| 281 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Sub") |
|---|
| 282 | opr DOT(self,b:Number):RR32 = |
|---|
| 283 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Mul") |
|---|
| 284 | opr TIMES(self,b:Number):RR32 = |
|---|
| 285 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Mul") |
|---|
| 286 | opr juxtaposition |
|---|
| 287 | (self,b:Number):RR32 = |
|---|
| 288 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Mul") |
|---|
| 289 | opr /(self,b:Number):RR32 = |
|---|
| 290 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Div") |
|---|
| 291 | opr SQRT(self):RR32 = |
|---|
| 292 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Sqrt") |
|---|
| 293 | opr PLUS_UP(self,b:Number):RR32 = |
|---|
| 294 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$AddUpNoNaN") |
|---|
| 295 | opr MINUS_UP(self,b:Number):RR32 = |
|---|
| 296 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$SubUpNoNaN") |
|---|
| 297 | opr DOT_UP(self,b:Number):RR32 = |
|---|
| 298 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$MulUpNoNaN") |
|---|
| 299 | opr SLASH_UP(self,b:Number):RR32 = |
|---|
| 300 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$DivUpNoNaN") |
|---|
| 301 | opr SQRT_UP(self):RR32 = |
|---|
| 302 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$SqrtUp") |
|---|
| 303 | opr PLUS_DOWN(self,b:Number):RR32 = |
|---|
| 304 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$AddDownNoNaN") |
|---|
| 305 | opr MINUS_DOWN(self,b:Number):RR32 = |
|---|
| 306 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$SubDownNoNaN") |
|---|
| 307 | opr DOT_DOWN(self,b:Number):RR32 = |
|---|
| 308 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$MulDownNoNaN") |
|---|
| 309 | opr SLASH_DOWN(self,b:Number):RR32 = |
|---|
| 310 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$DivDownNoNaN") |
|---|
| 311 | opr SQRT_DOWN(self):RR32 = |
|---|
| 312 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$SqrtDown") |
|---|
| 313 | opr IEEE_PLUS_UP(self,b:Number):RR32 = |
|---|
| 314 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$AddUp") |
|---|
| 315 | opr IEEE_MINUS_UP(self,b:Number):RR32 = |
|---|
| 316 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$SubUp") |
|---|
| 317 | opr IEEE_DOT_UP(self,b:Number):RR32 = |
|---|
| 318 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$MulUp") |
|---|
| 319 | opr IEEE_SLASH_UP(self,b:Number):RR32 = |
|---|
| 320 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$DivUp") |
|---|
| 321 | opr IEEE_PLUS_DOWN(self,b:Number):RR32 = |
|---|
| 322 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$AddDown") |
|---|
| 323 | opr IEEE_MINUS_DOWN(self,b:Number):RR32 = |
|---|
| 324 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$SubDown") |
|---|
| 325 | opr IEEE_DOT_DOWN(self,b:Number):RR32 = |
|---|
| 326 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$MulDown") |
|---|
| 327 | opr IEEE_SLASH_DOWN(self,b:Number):RR32 = |
|---|
| 328 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$DivDown") |
|---|
| 329 | opr ^(self, b:RR32):RR32 = |
|---|
| 330 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Pow") |
|---|
| 331 | opr ^(self, b:Float):RR64 = |
|---|
| 332 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Float$Pow") |
|---|
| 333 | opr ^(self, b:Number):RR64 = self^asFloat(b) |
|---|
| 334 | (** Shouldn't need this extra declaration. **) |
|---|
| 335 | opr ^(self, b:ZZ64):RR32 = |
|---|
| 336 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Pow") |
|---|
| 337 | floor(self):RR32 = |
|---|
| 338 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Floor") |
|---|
| 339 | opr |\self/| : ZZ64 = |
|---|
| 340 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$IFloor") |
|---|
| 341 | ceiling(self):RR32 = |
|---|
| 342 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Ceiling") |
|---|
| 343 | opr |/self\| : ZZ64 = |
|---|
| 344 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$ICeiling") |
|---|
| 345 | truncate(self):ZZ64 = |
|---|
| 346 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Truncate") |
|---|
| 347 | round(self):ZZ64 = |
|---|
| 348 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.RR32$Round") |
|---|
| 349 | |
|---|
| 350 | (** %MINNUM% and %MAXNUM% return a numeric result where possible (avoiding NaN). |
|---|
| 351 | Note that %MINNUM% and %MAX% form a lattice with NaN at the top, and |
|---|
| 352 | that %MAXNUM% and %MIN% form a lattice with NaN at the bottom. **) |
|---|
| 353 | opr MINNUM(self, b:RR32):RR32 = do |
|---|
| 354 | r = self MIN b |
|---|
| 355 | if r.isNaN then |
|---|
| 356 | if self.isNumber then self |
|---|
| 357 | elif b.isNumber then b |
|---|
| 358 | else r end |
|---|
| 359 | else |
|---|
| 360 | r |
|---|
| 361 | end |
|---|
| 362 | end |
|---|
| 363 | opr MAXNUM(self, b:RR32):RR32 = do |
|---|
| 364 | r = self MAX b |
|---|
| 365 | if r.isNaN then |
|---|
| 366 | if self.isNumber then self |
|---|
| 367 | elif b.isNumber then b |
|---|
| 368 | else r end |
|---|
| 369 | else |
|---|
| 370 | r |
|---|
| 371 | end |
|---|
| 372 | end |
|---|
| 373 | end |
|---|
| 374 | |
|---|
| 375 | value object Int extends ZZ32 |
|---|
| 376 | getter asString(): String = |
|---|
| 377 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$ToString") |
|---|
| 378 | getter asExprString(): String = |
|---|
| 379 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$ToString") |
|---|
| 380 | asFloat(self): Float = |
|---|
| 381 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$AsFloat") |
|---|
| 382 | end |
|---|
| 383 | |
|---|
| 384 | value object Long extends ZZ64 |
|---|
| 385 | getter asString(): String = |
|---|
| 386 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$ToString") |
|---|
| 387 | getter asExprString(): String = |
|---|
| 388 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$ToString") |
|---|
| 389 | asFloat(self): Float = |
|---|
| 390 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Long$AsFloat") |
|---|
| 391 | end |
|---|
| 392 | |
|---|
| 393 | value object NN32 extends { StandardTotalOrder[\NN32\], NN64 } |
|---|
| 394 | getter zero(): Number = unsigned(0) |
|---|
| 395 | getter one(): Number = unsigned(1) |
|---|
| 396 | getter asString(): String = |
|---|
| 397 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$ToString") |
|---|
| 398 | getter asExprString(): String = |
|---|
| 399 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$ToString") |
|---|
| 400 | |
|---|
| 401 | asFloat(self): Float = |
|---|
| 402 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$AsFloat") |
|---|
| 403 | |
|---|
| 404 | opr |self| : NN32 = self |
|---|
| 405 | opr =(self, b:NN32):Boolean = |
|---|
| 406 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Eq") |
|---|
| 407 | opr <(self, b:NN32):Boolean = |
|---|
| 408 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Less") |
|---|
| 409 | |
|---|
| 410 | opr -(self):NN32 = |
|---|
| 411 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Negate") |
|---|
| 412 | opr +(self,b:NN32):NN32 = |
|---|
| 413 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Add") |
|---|
| 414 | opr -(self,b:NN32):NN32 = |
|---|
| 415 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Sub") |
|---|
| 416 | opr DOT(self,b:NN32):NN32 = |
|---|
| 417 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Mul") |
|---|
| 418 | opr TIMES(self,b:NN32):NN32 = |
|---|
| 419 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Mul") |
|---|
| 420 | opr juxtaposition(self,b:NN32):NN32 = |
|---|
| 421 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Mul") |
|---|
| 422 | opr DIV(self,b:NN32):NN32 = |
|---|
| 423 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Div") |
|---|
| 424 | opr REM(self,b:NN32):NN32 = |
|---|
| 425 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Rem") |
|---|
| 426 | opr MOD(self,b:NN32):NN32 = |
|---|
| 427 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Mod") |
|---|
| 428 | opr GCD(self,b:NN32):NN32 = |
|---|
| 429 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Gcd") |
|---|
| 430 | opr LCM(self,b:NN32):NN32 = |
|---|
| 431 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Lcm") |
|---|
| 432 | opr CHOOSE(self,b:NN32):NN32 = |
|---|
| 433 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Choose") |
|---|
| 434 | opr BITAND(self,b:NN32):NN32 = |
|---|
| 435 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$BitAnd") |
|---|
| 436 | opr BITOR(self,b:NN32):NN32 = |
|---|
| 437 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$BitOr") |
|---|
| 438 | opr BITXOR(self,b:NN32):NN32 = |
|---|
| 439 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$BitXor") |
|---|
| 440 | opr LSHIFT(self,b:AnyIntegral):NN32 = |
|---|
| 441 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$LShift") |
|---|
| 442 | opr RSHIFT(self,b:AnyIntegral):NN32 = |
|---|
| 443 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$RShift") |
|---|
| 444 | opr BITNOT(self):NN32 = |
|---|
| 445 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$BitNot") |
|---|
| 446 | opr ^(self, b:AnyIntegral):RR64 = |
|---|
| 447 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Pow") |
|---|
| 448 | widen(self):NN64 = |
|---|
| 449 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$ToUnsignedLong") |
|---|
| 450 | partitionL(self):NN32 = |
|---|
| 451 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$Partition") |
|---|
| 452 | signed(self):ZZ32 = |
|---|
| 453 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.NN32$ToInt") |
|---|
| 454 | end |
|---|
| 455 | |
|---|
| 456 | value object UnsignedLong extends NN64 |
|---|
| 457 | getter zero(): UnsignedLong = widen(unsigned(0)) |
|---|
| 458 | getter one(): UnsignedLong = widen(unsigned(1)) |
|---|
| 459 | getter asString(): String = |
|---|
| 460 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.UnsignedLong$ToString") |
|---|
| 461 | getter asExprString(): String = |
|---|
| 462 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.UnsignedLong$ToString") |
|---|
| 463 | asFloat(self): Float = |
|---|
| 464 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.UnsignedLong$AsFloat") |
|---|
| 465 | end |
|---|
| 466 | |
|---|
| 467 | object IntLiteral extends ZZ32 |
|---|
| 468 | getter zero(): IntLiteral = big(0) |
|---|
| 469 | getter one(): IntLiteral = big(1) |
|---|
| 470 | getter asString(): String = |
|---|
| 471 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$ToString") |
|---|
| 472 | getter asExprString(): String = |
|---|
| 473 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$ToString") |
|---|
| 474 | |
|---|
| 475 | asFloat(self): Float = |
|---|
| 476 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$AsFloat") |
|---|
| 477 | |
|---|
| 478 | opr |self| : ZZ32 = if self>=0 then self else -self end |
|---|
| 479 | opr =(self, b: IntLiteral):Boolean = |
|---|
| 480 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Eq") |
|---|
| 481 | opr <(self, other:IntLiteral): Boolean = self.cmp(other) < 0 |
|---|
| 482 | opr <=(self, other:IntLiteral): Boolean = self.cmp(other) <= 0 |
|---|
| 483 | opr >(self, other:IntLiteral): Boolean = self.cmp(other) > 0 |
|---|
| 484 | opr >=(self, other:IntLiteral): Boolean = self.cmp(other) >= 0 |
|---|
| 485 | opr CMP(self, other:IntLiteral): TotalComparison = self.cmp(other) CMP 0 |
|---|
| 486 | cmp(b:IntLiteral): ZZ32 = |
|---|
| 487 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Cmp") |
|---|
| 488 | |
|---|
| 489 | (* |
|---|
| 490 | Do not enable these until coercion is implemented; doing so will |
|---|
| 491 | cause all our arithmetic to occur on IntLiterals. |
|---|
| 492 | |
|---|
| 493 | opr -(self): IntLiteral = |
|---|
| 494 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Negate") |
|---|
| 495 | opr +(self, b: IntLiteral): IntLiteral = |
|---|
| 496 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Add") |
|---|
| 497 | opr -(self, b: IntLiteral): IntLiteral = |
|---|
| 498 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Sub") |
|---|
| 499 | opr DOT(self, b: IntLiteral): IntLiteral = |
|---|
| 500 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Mul") |
|---|
| 501 | opr juxtaposition(self, b: IntLiteral): IntLiteral = |
|---|
| 502 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Mul") |
|---|
| 503 | opr TIMES(self, b: IntLiteral): IntLiteral = |
|---|
| 504 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Mul") |
|---|
| 505 | opr DIV(self, b: IntLiteral): IntLiteral = |
|---|
| 506 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Div") |
|---|
| 507 | opr REM(self, b: IntLiteral): IntLiteral = |
|---|
| 508 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Rem") |
|---|
| 509 | opr MOD(self, b: IntLiteral): IntLiteral = |
|---|
| 510 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Mod") |
|---|
| 511 | opr GCD(self, b: IntLiteral): IntLiteral = |
|---|
| 512 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Gcd") |
|---|
| 513 | opr LCM(self, b: IntLiteral): IntLiteral = |
|---|
| 514 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Lcm") |
|---|
| 515 | opr CHOOSE(self, b: IntLiteral): IntLiteral = |
|---|
| 516 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Choose") |
|---|
| 517 | opr BITAND(self, b: IntLiteral): IntLiteral = |
|---|
| 518 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$BitAnd") |
|---|
| 519 | opr BITOR(self, b: IntLiteral): IntLiteral = |
|---|
| 520 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$BitOr") |
|---|
| 521 | opr BITXOR(self, b: IntLiteral): IntLiteral = |
|---|
| 522 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$BitXor") |
|---|
| 523 | opr LSHIFT(self, b:AnyIntegral): IntLiteral = |
|---|
| 524 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$LShift") |
|---|
| 525 | opr RSHIFT(self, b:AnyIntegral): IntLiteral = |
|---|
| 526 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$RShift") |
|---|
| 527 | opr BITNOT(self): IntLiteral = |
|---|
| 528 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$BitNot") |
|---|
| 529 | opr ^(self, b:AnyIntegral):RR64 = |
|---|
| 530 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.IntLiteral$Pow") |
|---|
| 531 | *) |
|---|
| 532 | end |
|---|
| 533 | |
|---|
| 534 | value object BigNum extends ZZ |
|---|
| 535 | getter asString(): String = |
|---|
| 536 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.BigNum$ToString") |
|---|
| 537 | getter asExprString(): String = |
|---|
| 538 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.BigNum$ToString") |
|---|
| 539 | asFloat(self): Float = |
|---|
| 540 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.BigNum$AsFloat") |
|---|
| 541 | end |
|---|
| 542 | |
|---|
| 543 | |
|---|
| 544 | value object Boolean |
|---|
| 545 | extends { Condition[\()\], StandardTotalOrder[\Boolean\] } |
|---|
| 546 | getter holds(): Boolean = self |
|---|
| 547 | getter get(): () = () |
|---|
| 548 | getter asString(): Boolean = self.asExprString |
|---|
| 549 | getter asExprString(): Boolean = if self then "true" else "false" end |
|---|
| 550 | getter size(): ZZ32 = |self| |
|---|
| 551 | opr |self| : ZZ32 = if self then 1 else 0 end |
|---|
| 552 | cond[\R\](t:()->R, e:()->R) : R = if self then t() else e() end |
|---|
| 553 | generate[\R\](r:Reduction[\R\],b:()->R): R = |
|---|
| 554 | if self then b() else r.empty() end |
|---|
| 555 | map[\G\](f: ()->G): Maybe[\G\] = |
|---|
| 556 | if self then Just[\G\](f()) else Nothing[\G\] end |
|---|
| 557 | cross[\G\](g: Generator[\G\]): Generator[\((),G)\] = |
|---|
| 558 | if self |
|---|
| 559 | then g.map[\((),G)\](fn (e:G):((),G) => ((),e)) |
|---|
| 560 | else Nothing[\((),G)\] end |
|---|
| 561 | |
|---|
| 562 | mapReduce[\R\](b: ()->R, _:(R,R)->R, z:R): R = |
|---|
| 563 | if self then b() else z end |
|---|
| 564 | loop(f:()->()): () = if self then f() end |
|---|
| 565 | |
|---|
| 566 | opr =(self, other:Boolean): Boolean = |
|---|
| 567 | if self then other else NOT other end |
|---|
| 568 | opr <(self, other:Boolean): Boolean = |
|---|
| 569 | if self then false else other end |
|---|
| 570 | opr CMP(self, other:Boolean): TotalComparison = |
|---|
| 571 | if self then |
|---|
| 572 | if other then EqualTo else GreaterThan end |
|---|
| 573 | else |
|---|
| 574 | if other then LessThan else EqualTo end |
|---|
| 575 | end |
|---|
| 576 | end |
|---|
| 577 | |
|---|
| 578 | myJavaDigit(x:Char, radix:ZZ32): ZZ32 = javaDigit(x, radix) |
|---|
| 579 | |
|---|
| 580 | value object Char extends { StandardTotalOrder[\Char\] } |
|---|
| 581 | getter asString(): String = |
|---|
| 582 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$ToString") |
|---|
| 583 | getter asExprString(): String = |
|---|
| 584 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$ToExprString") |
|---|
| 585 | getter codePoint(): ZZ32 = |
|---|
| 586 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$CodePoint") |
|---|
| 587 | opr |self| : ZZ32 = self.codePoint |
|---|
| 588 | opr =(self, other:Char): Boolean = |
|---|
| 589 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$Eq") |
|---|
| 590 | opr <(self, other:Char): Boolean = |
|---|
| 591 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$LessThan") |
|---|
| 592 | |
|---|
| 593 | opr SIMEQ(self, other:Char): Boolean = |
|---|
| 594 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$SimEq") |
|---|
| 595 | opr NSIMEQ(self, other:Char): Boolean = |
|---|
| 596 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$NotSimEq") |
|---|
| 597 | opr LNSIM(self, other:Char): Boolean = |
|---|
| 598 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$LessNotSim") |
|---|
| 599 | opr LESSSIM(self, other:Char): Boolean = |
|---|
| 600 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$LessSim") |
|---|
| 601 | opr GNSIM(self, other:Char): Boolean = |
|---|
| 602 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$GreaterNotSim") |
|---|
| 603 | opr GTRSIM(self, other:Char): Boolean = |
|---|
| 604 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$GreaterSim") |
|---|
| 605 | |
|---|
| 606 | javaDigit(self, radix:ZZ32): ZZ32 = |
|---|
| 607 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$JavaDigit") |
|---|
| 608 | |
|---|
| 609 | digit(self): Maybe[\ZZ32\] = do |
|---|
| 610 | x:ZZ32 = myJavaDigit(self,10) |
|---|
| 611 | if (x = -1) then Nothing[\ZZ32\] else Just[\ZZ32\](x) end |
|---|
| 612 | end |
|---|
| 613 | digit(self, radix:ZZ32): Maybe[\ZZ32\] = do |
|---|
| 614 | (* radix 12 is a special case whose behavior deviates from |
|---|
| 615 | Character.digit in Java, so we handle it differently here. *) |
|---|
| 616 | if(11 <= radix <= 12) then |
|---|
| 617 | if(self = 'X' OR self = 'x') then |
|---|
| 618 | Just[\ZZ32\](10) |
|---|
| 619 | elif(self = 'E' OR self = 'e') then |
|---|
| 620 | Just[\ZZ32\](11) |
|---|
| 621 | else |
|---|
| 622 | Nothing[\ZZ32\] |
|---|
| 623 | end |
|---|
| 624 | else |
|---|
| 625 | x:ZZ32 = myJavaDigit(self, radix) |
|---|
| 626 | if(x = -1 OR (NOT(2 <= radix <= 16))) then |
|---|
| 627 | Nothing[\ZZ32\] |
|---|
| 628 | else |
|---|
| 629 | Just[\ZZ32\](x) |
|---|
| 630 | end |
|---|
| 631 | end |
|---|
| 632 | end |
|---|
| 633 | |
|---|
| 634 | getDirectionality(self): ZZ32 = |
|---|
| 635 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$GetDirectionality") |
|---|
| 636 | getNumericValue(self): ZZ32 = |
|---|
| 637 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$GetNumericValue") |
|---|
| 638 | getType(self): ZZ32 = |
|---|
| 639 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$GetType") |
|---|
| 640 | isDefined(self): Boolean = |
|---|
| 641 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsDefined") |
|---|
| 642 | isDigit(self): Boolean = |
|---|
| 643 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsDigit") |
|---|
| 644 | isFortressIdentifierPart(self): Boolean = |
|---|
| 645 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsFortressIdentifierPart") |
|---|
| 646 | isFortressIdentifierStart(self): Boolean = |
|---|
| 647 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsFortressIdentifierStart") |
|---|
| 648 | isHighSurrogate(self): Boolean = |
|---|
| 649 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsHighSurrogate") |
|---|
| 650 | isIdentifierIgnorable(self): Boolean = |
|---|
| 651 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsIdentifierIgnorable") |
|---|
| 652 | isISOControl(self): Boolean = |
|---|
| 653 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsISOControl") |
|---|
| 654 | isJavaIdentifierPart(self): Boolean = |
|---|
| 655 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsJavaIdentifierPart") |
|---|
| 656 | isJavaIdentifierStart(self): Boolean = |
|---|
| 657 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsJavaIdentifierStart") |
|---|
| 658 | isLetter(self): Boolean = |
|---|
| 659 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsLetter") |
|---|
| 660 | isLetterOrDigit(self): Boolean = |
|---|
| 661 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsLetterOrDigit") |
|---|
| 662 | isLowerCase(self): Boolean = |
|---|
| 663 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsLowerCase") |
|---|
| 664 | isLowSurrogate(self): Boolean = |
|---|
| 665 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsLowSurrogate") |
|---|
| 666 | isMirrored(self): Boolean = |
|---|
| 667 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsMirrored") |
|---|
| 668 | isSpaceChar(self): Boolean = |
|---|
| 669 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsSpaceChar") |
|---|
| 670 | isSupplementaryCodePoint(self): Boolean = |
|---|
| 671 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsSupplementaryCodePoint") |
|---|
| 672 | isSurrogatePair(self, low:Char): Boolean = |
|---|
| 673 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsSurrogatePair") |
|---|
| 674 | isTitleCase(self): Boolean = |
|---|
| 675 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsTitleCase") |
|---|
| 676 | isUnicodeIdentifierPart(self): Boolean = |
|---|
| 677 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsUnicodeIdentifierPart") |
|---|
| 678 | isUnicodeIdentifierStart(self): Boolean = |
|---|
| 679 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsUnicodeIdentifierStart") |
|---|
| 680 | isUpperCase(self): Boolean = |
|---|
| 681 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsUpperCase") |
|---|
| 682 | isValidCodePoint(self): Boolean = |
|---|
| 683 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsValidCodePoint") |
|---|
| 684 | isWhitespace(self): Boolean = |
|---|
| 685 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$IsWhitespace") |
|---|
| 686 | toLowerCase(self): Char = |
|---|
| 687 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$ToLowerCase") |
|---|
| 688 | toTitleCase(self): Char = |
|---|
| 689 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$ToTitleCase") |
|---|
| 690 | toUpperCase(self): Char = |
|---|
| 691 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Char$ToUpperCase") |
|---|
| 692 | end |
|---|
| 693 | |
|---|
| 694 | object Thread[\T\] (fcn:()->T) |
|---|
| 695 | val():T = |
|---|
| 696 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Thread$val") |
|---|
| 697 | wait():() = |
|---|
| 698 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Thread$wait") |
|---|
| 699 | ready():Boolean = |
|---|
| 700 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Thread$ready") |
|---|
| 701 | stop():() = |
|---|
| 702 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Thread$stop") |
|---|
| 703 | end |
|---|
| 704 | |
|---|
| 705 | abort():() = builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Thread$abort") |
|---|
| 706 | |
|---|
| 707 | end |
|---|