[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:46:43 UTC 2010
The following commit has been merged in the master branch:
commit bc232a79fb038fdb3c498040ef74731271401665
Author: John Goerzen <jgoerzen at complete.org>
Date: Mon Nov 15 09:03:20 2004 +0100
Checkpointing
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.5--patch-42)
diff --git a/ChangeLog b/ChangeLog
index 27904d4..b4d23c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
#
+2004-11-15 02:03:20 GMT John Goerzen <jgoerzen at complete.org> patch-42
+
+ Summary:
+ Checkpointing
+ Revision:
+ missingh--head--0.5--patch-42
+
+
+ modified files:
+ ChangeLog libsrc/MissingH/Printf.hs
+
+
2004-11-15 01:34:01 GMT John Goerzen <jgoerzen at complete.org> patch-41
Summary:
diff --git a/libsrc/MissingH/Printf.hs b/libsrc/MissingH/Printf.hs
index 7fdc0ff..a4a34a2 100644
--- a/libsrc/MissingH/Printf.hs
+++ b/libsrc/MissingH/Printf.hs
@@ -54,10 +54,23 @@ import Data.List
import System.IO
import MissingH.Printf.Types
import MissingH.Printf.Printer(get_conversion_func)
+import Text.Regex
v :: PFType a => a -> Value
v = toValue
+sprintfre = mkRegex "^([#0 +'O-]*)(\\d*)(.\\d*)?([.])"
+
+toflags :: String -> [Flag]
+toflags "" = []
+toflags (x:xs) = (case x of
+ '#' -> AlternateForm
+ '0' -> ZeroPadded
+ '-' -> LeftAdjust
+ ' ' -> BlankPlus
+ '+' -> Plus
+ '\'' -> Thousands
+ 'I' -> AlternativeDigits) : toflags xs
sprintf :: String -> [Value] -> String
sprintf [] [] = []
@@ -67,10 +80,24 @@ sprintf ('%' : xs) (y : ys) = (fromValue y) ++ sprintf xs ys
sprintf ('!' : xs) (y : ys) =
show (((fromValue y)::Int) + 1) ++ sprintf xs ys -}
+{-
sprintf ('%' : t : xs) (y:ys) =
let cv = get_conversion_func t y [] Nothing Nothing
in
cv ++ sprintf xs ys
+-}
+
+sprintf ('%' : xs) (y : ys) =
+ case matchRegexAll sprintfre xs of
+ Nothing -> error $ "Problem in format string at %" ++ xs
+ Just (_, _, remainder, [flagstr, widthstr, precstr, fmt]) ->
+ let width = if widthstr == "" then Nothing else Just (read widthstr)
+ prec = if precstr == "" then Nothing else Just precstr
+ flags = toflags flagstr
+ in
+ (get_conversion_func (head fmt) y flags width prec) ++ sprintf remainder ys
+ _ -> error $ "Problem matching format string at %" ++ xs
+
sprintf (x:xs) y = x : sprintf xs y
vsprintf :: (PFRun a) => String -> a
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list