Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/branches/FLINT/src/compiler/PervEnv/Basis/sml90.sml
ViewVC logotype

Annotation of /sml/branches/FLINT/src/compiler/PervEnv/Basis/sml90.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 227 - (view) (download)

1 : monnier 89 (* sml90.sig
2 :     *
3 :     * COPYRIGHT (c) 1997 Bell Labs, Lucent Technologies.
4 :     *)
5 :    
6 :     structure SML90 :> SML90 =
7 :     struct
8 :    
9 :     exception Io of string
10 :     exception Sqrt
11 :     exception Ln
12 :     exception Ord = General.Overflow
13 :     exception Abs = General.Overflow
14 :     exception Prod = General.Overflow
15 :     exception Neg = General.Overflow
16 :     exception Sum = General.Overflow
17 :     exception Diff = General.Overflow
18 :     exception Floor = General.Overflow
19 :     exception Exp = General.Overflow
20 :     exception Quot = General.Div
21 :     exception Mod = General.Div
22 :     exception Interrupt
23 :    
24 :     fun sqrt x = if (x >= 0.0) then Math.sqrt x else raise Sqrt
25 :     fun exp x = let
26 :     val r = Math.exp x
27 :     in
28 :     if (Real.isFinite r) then r else raise Exp
29 :     end
30 :     fun ln x = if (x > 0.0) then Math.ln x else raise Ln
31 :     val sin = Math.sin
32 :     val cos = Math.cos
33 :     val arctan = Math.atan
34 :     fun ord s = Char.ord(String.sub(s, 0))
35 :     fun chr i = String.str(Char.chr i)
36 :     fun explode s = CharVector.foldr (fn (c, l) => String.str c :: l) [] s
37 :     val implode = String.concat
38 :    
39 :     type instream = TextIO.instream
40 :     type outstream = TextIO.outstream
41 :    
42 :     fun wrapIO f x = (f x) handle ex => raise Io(ExnName.exnMessage ex)
43 :     val std_in = TextIO.stdIn
44 :     val open_in = wrapIO TextIO.openIn
45 :     val input = wrapIO TextIO.inputN
46 :     fun lookahead strm = (case wrapIO TextIO.lookahead strm
47 :     of NONE => raise Io "end of file"
48 :     | (SOME c) => String.str c
49 :     (* end case *))
50 :     val close_in = wrapIO TextIO.closeIn
51 :     val end_of_stream = wrapIO TextIO.endOfStream
52 :     val std_out = TextIO.stdOut
53 :     val open_out = wrapIO TextIO.openOut
54 :     val output = wrapIO TextIO.output
55 :     val close_out = wrapIO TextIO.closeOut
56 :    
57 :     end;
58 :    
59 :     (*
60 : monnier 227 * $Log$
61 : monnier 89 *)
62 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0