CVS: sml-dist/src/system/Basis/Implementation num-scan.sml, 1.4, 1.4.8.1
George Kuan <[email protected]> Tue, 05 Sep 2006 10:59:53 -0700
| Newsgroups | gmane.comp.lang.sml.smlnj.commits |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/smlnj/sml-dist/src/system/Basis/Implementation
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4621/system/Basis/Implementation
Modified Files:
Tag: primop-branch-2
num-scan.sml
Log Message:
Narrowed down num-scan.sml type error
Index: num-scan.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/system/Basis/Implementation/num-scan.sml,v
retrieving revision 1.4
retrieving revision 1.4.8.1
diff -C2 -d -r1.4 -r1.4.8.1
*** num-scan.sml 17 Sep 2003 21:28:40 -0000 1.4
--- num-scan.sml 5 Sep 2006 17:59:51 -0000 1.4.8.1
***************
*** 10,22 ****
structure NumScan : sig
! val scanWord : StringCvt.radix
-> (char, 'a) StringCvt.reader -> (Word32.word, 'a) StringCvt.reader
val scanInt : StringCvt.radix
-> (char, 'a) StringCvt.reader -> (Int32.int, 'a) StringCvt.reader
! val scanReal : (char, 'a) StringCvt.reader -> (real, 'a) StringCvt.reader
(** should be to LargeReal.real **)
end = struct
!
structure W = InlineT.Word32
structure I = InlineT.Int31
--- 10,22 ----
structure NumScan : sig
! (* val scanWord : StringCvt.radix
-> (char, 'a) StringCvt.reader -> (Word32.word, 'a) StringCvt.reader
val scanInt : StringCvt.radix
-> (char, 'a) StringCvt.reader -> (Int32.int, 'a) StringCvt.reader
! val scanReal : (char, 'a) StringCvt.reader -> (real, 'a) StringCvt.reader *)
(** should be to LargeReal.real **)
end = struct
! (*
structure W = InlineT.Word32
structure I = InlineT.Int31
***************
*** 29,41 ****
val op + = W.+
val op - = W.-
! val op * = W.*
!
val largestWordDiv10 : word = 0w429496729 (* 2^32-1 divided by 10 *)
val largestWordMod10 : word = 0w5 (* remainder *)
!
val largestNegInt32 : word = 0wx80000000
val largestPosInt32 : word = 0wx7fffffff
val minInt32 : Int32.int = ~2147483648
!
(* A table for mapping digits to values. Whitespace characters map to
* 128, "+" maps to 129, "-","~" map to 130, "." maps to 131, and the
--- 29,41 ----
val op + = W.+
val op - = W.-
! val op * = W.* *)
! (*
val largestWordDiv10 : word = 0w429496729 (* 2^32-1 divided by 10 *)
val largestWordMod10 : word = 0w5 (* remainder *)
!
val largestNegInt32 : word = 0wx80000000
val largestPosInt32 : word = 0wx7fffffff
val minInt32 : Int32.int = ~2147483648
! *)
(* A table for mapping digits to values. Whitespace characters map to
* 128, "+" maps to 129, "-","~" map to 130, "." maps to 131, and the
***************
*** 43,46 ****
--- 43,47 ----
* characters map to 255.
*)
+ (*
local
val cvtTable = "\
***************
*** 64,67 ****
--- 65,69 ----
val ord = InlineT.Char.ord
in
+
fun code (c : char) =
W.fromInt(ord(InlineT.CharVector.sub(cvtTable, ord c)))
***************
*** 109,112 ****
--- 111,115 ----
digit or point code is returned as the value of next.
*)
+
fun scanPrefix (p : prefix_pat) getc cs = let
fun getNext cs = (case (getc cs)
***************
*** 192,196 ****
end
(* end case *))
!
fun scanOct isWord getc cs = (case (scanPrefix (octPat isWord) getc cs)
of NONE => NONE
--- 195,199 ----
end
(* end case *))
!
fun scanOct isWord getc cs = (case (scanPrefix (octPat isWord) getc cs)
of NONE => NONE
***************
*** 212,216 ****
end
(* end case *))
!
fun scanDec isWord getc cs = (case (scanPrefix (decPat(isWord,false)) getc cs)
of NONE => NONE
--- 215,219 ----
end
(* end case *))
!
fun scanDec isWord getc cs = (case (scanPrefix (decPat(isWord,false)) getc cs)
of NONE => NONE
***************
*** 235,239 ****
end
(* end case *))
!
fun scanHex isWord getc cs = (case (scanPrefix (hexPat isWord) getc cs)
of NONE => NONE
--- 238,242 ----
end
(* end case *))
!
fun scanHex isWord getc cs = (case (scanPrefix (hexPat isWord) getc cs)
of NONE => NONE
***************
*** 255,263 ****
end
(* end case *))
!
fun finalWord scanFn getc cs = (case (scanFn true getc cs)
of NONE => NONE
| (SOME{neg, word, rest}) => SOME(word, rest)
(* end case *))
fun scanWord StringCvt.BIN = finalWord scanBin
--- 258,267 ----
end
(* end case *))
!
fun finalWord scanFn getc cs = (case (scanFn true getc cs)
of NONE => NONE
| (SOME{neg, word, rest}) => SOME(word, rest)
(* end case *))
+
fun scanWord StringCvt.BIN = finalWord scanBin
***************
*** 265,272 ****
| scanWord StringCvt.DEC = finalWord scanDec
| scanWord StringCvt.HEX = finalWord scanHex
!
local
! val fromword32 = I32.fromLarge o W.toLargeIntX
in
fun finalInt scanFn getc cs = (case (scanFn false getc cs)
of NONE => NONE
--- 269,277 ----
| scanWord StringCvt.DEC = finalWord scanDec
| scanWord StringCvt.HEX = finalWord scanHex
! *)
local
! val fromword32 = InlineT.Int32.fromLarge o InlineT.Word32.toLargeIntX
in
+ (*
fun finalInt scanFn getc cs = (case (scanFn false getc cs)
of NONE => NONE
***************
*** 284,289 ****
SOME(fromword32 word, rest)
(* end case *))
! end
!
fun scanInt StringCvt.BIN = finalInt scanBin
| scanInt StringCvt.OCT = finalInt scanOct
--- 289,295 ----
SOME(fromword32 word, rest)
(* end case *))
! *)
! end (* end local *)
! (*
fun scanInt StringCvt.BIN = finalInt scanBin
| scanInt StringCvt.OCT = finalInt scanOct
***************
*** 416,421 ****
| NONE => NONE (* ASSERT: this case can't happen *)
(* end case *))
end
!
end;
--- 422,428 ----
| NONE => NONE (* ASSERT: this case can't happen *)
(* end case *))
+
end
! *)
end;
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642