root/trunk/ProjectFortress/LibraryBuiltin/FortressBuiltin.fsi

Revision 3444, 8.0 KB (checked in by sukyoungryu, 9 months ago)

[parser] Revised the methods grammar.

Line 
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
18api FortressBuiltin
19
20(** The %builtinPrimitive% function is actually recognized as a special piece
21    of built-in magic by the Fortress interpreter.  The %javaClass%
22    argument names a Java Class which is a subclass of
23    \texttt{com.sun.fortress.interpreter.glue.NativeApp}, which provides code
24    for the closure which is used in place of the call to
25    %builtinPrimitive%.  Meanwhile all the necessary type information,
26    argument names, etc. must be declared here in Fortress-land.  For
27    examples, see the end of this file.
28
29    In practice, if you are extending the interpreter you will probably
30    want to extend \texttt{com.sun.fortress.interpreter.glue.NativeFn0,1,2,3,4}
31    or one of their subclasses defined in
32    \texttt{com.sun.fortress.interpreter.glue.primitive}.  These types are
33    generally easier to work with, and the boilerplate packing and
34    unpacking of values is done for you.
35**)
36builtinPrimitive[\T\](javaClass:String):T
37
38trait Object extends Any
39    getter ilkName(): String
40    getter asString(): String                (* for normal use *)
41    getter asDebugString(): String    (* for debugging; may contain more information *)
42    getter asExprString(): String       (* when considered as Fortress expression, will equal self *)
43
44    getter toString(): String                (* deprecated *)
45end
46
47value object Float extends RR64
48end
49
50object FloatLiteral extends RR64
51end
52
53value object RR32 extends RR64
54    (** returns true if the value is an IEEE NaN **)
55    getter isNaN(): Boolean
56    (** returns true if the value is an IEEE infinity **)
57    getter isInfinite(): Boolean
58    (** returns true if the value is a valid number (not NaN) **)
59    getter isNumber(): Boolean
60    (** returns true if the value is finite **)
61    getter isFinite(): Boolean
62    (** %check% returns %Just(its argument)% if it is finite, otherwise %Nothing%. **)
63    getter check(): Maybe[\RR32\]
64    (** %check_star% returns %Just(its argument)% if it is non-NaN, otherwise %Nothing%. **)
65    getter check_star(): Maybe[\RR32\]
66    (** obtain the raw bits of the IEEE floating-point representation of this value. **)
67    getter rawBits():ZZ32
68    (** obtain the sign bit of the IEEE floating-point representation of this value. **)
69    getter signBit():ZZ32
70    (** next higher IEEE float **)
71    getter nextUp():RR32
72    (** next lower IEEE float **)
73    getter nextDown():RR32
74    opr ^(self, b:RR32):RR32
75    (** %MINNUM% and %MAXNUM% return a numeric result where possible (avoiding NaN).
76        Note that %MINNUM% and %MAX% form a lattice with NaN at the top, and
77        that %MAXNUM% and %MIN% form a lattice with NaN at the bottom.  **)
78    opr MINNUM(self, b:RR32):RR32
79    opr MAXNUM(self, b:RR32):RR32
80end
81
82value object Int extends ZZ32
83end
84
85value object Long extends ZZ64
86end
87
88value object NN32 extends { StandardTotalOrder[\NN32\], NN64 }
89    opr |self| : NN32
90    opr =(self, b:NN32):Boolean
91    opr <(self, b:NN32):Boolean
92    opr -(self):NN32
93    opr +(self,b:NN32):NN32
94    opr -(self,b:NN32):NN32
95    opr DOT(self,b:NN32):NN32
96    opr TIMES(self,b:NN32):NN32
97    opr juxtaposition(self,b:NN32):NN32
98    opr DIV(self,b:NN32):NN32
99    opr REM(self,b:NN32):NN32
100    opr MOD(self,b:NN32):NN32
101    opr GCD(self,b:NN32):NN32
102    opr LCM(self,b:NN32):NN32
103    opr CHOOSE(self,b:NN32):NN32
104    opr BITAND(self,b:NN32):NN32
105    opr BITOR(self,b:NN32):NN32
106    opr BITXOR(self,b:NN32):NN32
107    opr LSHIFT(self,b:AnyIntegral):NN32
108    opr RSHIFT(self,b:AnyIntegral):NN32
109    opr BITNOT(self):NN32
110    opr ^(self, b:AnyIntegral):RR64
111    widen(self):NN64
112    partitionL(self):NN32
113    signed(self):ZZ32
114end
115
116value object UnsignedLong extends NN64
117end
118
119object IntLiteral extends { ZZ32 }
120    opr =(self, b: IntLiteral):Boolean
121    opr <(self, other:IntLiteral): Boolean
122    opr <=(self, other:IntLiteral): Boolean
123    opr >(self, other:IntLiteral): Boolean
124    opr >=(self, other:IntLiteral): Boolean
125    opr CMP(self, other:IntLiteral): TotalComparison
126
127(*
128Do not enable these until coercion is implemented; doing so will
129cause all our arithmetic to occur on IntLiterals.
130    opr -(self): IntLiteral
131    opr +(self, b: IntLiteral): IntLiteral
132    opr -(self, b: IntLiteral): IntLiteral
133    opr DOT(self, b: IntLiteral): IntLiteral
134    opr juxtaposition(self, b: IntLiteral): IntLiteral
135    opr DIV(self, b: IntLiteral): IntLiteral
136    opr REM(self, b: IntLiteral): IntLiteral
137    opr MOD(self, b: IntLiteral): IntLiteral
138    opr GCD(self, b: IntLiteral): IntLiteral
139    opr LCM(self, b: IntLiteral): IntLiteral
140    opr CHOOSE(self, b: IntLiteral): IntLiteral
141    opr BITAND(self, b: IntLiteral): IntLiteral
142    opr BITOR(self, b: IntLiteral): IntLiteral
143    opr BITXOR(self, b: IntLiteral): IntLiteral
144    opr LSHIFT(self, b:AnyIntegral): IntLiteral
145    opr RSHIFT(self, b:AnyIntegral): IntLiteral
146    opr BITNOT(self): IntLiteral
147    opr ^(self, b:AnyIntegral):RR64
148*)
149end
150
151object BigNum extends ZZ end
152
153value object Boolean
154    extends { Condition[\()\], StandardTotalOrder[\Boolean\] }
155end
156
157value object Char extends { StandardTotalOrder[\Char\] }
158    (** %char.codePoint% converts %char% to the equivalent integer code point.
159        It is always the case that %c = char(c.codePoint())% for %c : Char%. **)
160    getter codePoint(): ZZ32
161
162    (** |c| means the same as %c.ord()%; it's unclear if this is
163        actually a good idea, and we solicit feedback on the subject. **)
164    opr |self| : ZZ32
165
166    (** Ordering respects %codePoint%. **)
167    opr =(self, other:Char): Boolean
168    opr <(self, other:Char): Boolean
169    opr SIMEQ(self, other:Char): Boolean
170    opr NSIMEQ(self, other:Char): Boolean
171    opr LNSIM(self, other:Char): Boolean
172    opr LESSSIM(self, other:Char): Boolean
173    opr GNSIM(self, other:Char): Boolean
174    opr GTRSIM(self, other:Char): Boolean
175
176    (* The following methods have the same behavior as the methods in Java
177       Character class, except for methods digit and forDigit.  These two
178       particular methods deviate from Java Character class when it gets
179       argument radix = 12.  For radix 12, the digits are "0123456789xe"
180       instead of "0123456789ab". *)
181    (* javaDigit(self, radix:ZZ32): ZZ32 *)
182    digit(self): Maybe[\ZZ32\] (* radix 10 *)
183    digit(self, radix:ZZ32): Maybe[\ZZ32\]
184    getDirectionality(self): ZZ32
185    getNumericValue(self): ZZ32
186    getType(self): ZZ32
187    isDefined(self): Boolean
188    isDigit(self): Boolean
189    isFortressIdentifierPart(self): Boolean
190    isFortressIdentifierStart(self): Boolean
191    isHighSurrogate(self): Boolean
192    isIdentifierIgnorable(self): Boolean
193    isISOControl(self): Boolean
194    isJavaIdentifierPart(self): Boolean
195    isJavaIdentifierStart(self): Boolean
196    isLetter(self): Boolean
197    isLetterOrDigit(self): Boolean
198    isLowerCase(self): Boolean
199    isLowSurrogate(self): Boolean
200    isMirrored(self): Boolean
201    isSpaceChar(self): Boolean
202    isSupplementaryCodePoint(self): Boolean
203    isSurrogatePair(self, low: Char): Boolean
204    isTitleCase(self): Boolean
205    isUnicodeIdentifierPart(self): Boolean
206    isUnicodeIdentifierStart(self): Boolean
207    isUpperCase(self): Boolean
208    isValidCodePoint(self): Boolean
209    isWhitespace(self): Boolean
210    toLowerCase(self): Char
211    toTitleCase(self): Char
212    toUpperCase(self): Char
213end
214
215object Thread[\T\](fcn:()->T)
216    getter val():T
217    getter ready():Boolean
218    wait():()
219    stop():()
220end
221
222abort():()
223
224end
Note: See TracBrowser for help on using the browser.