summaryrefslogtreecommitdiff
path: root/lib/std/fmt.myr
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2019-09-07 12:50:50 -0400
committerS. Gilles <sgilles@math.umd.edu>2019-09-07 12:50:50 -0400
commit3b5584581a79cec899c7f6a5233529a64a22ab5f (patch)
treed4870921253369ef0ab944ca4e729a6319cd83d7 /lib/std/fmt.myr
parentcf50193c7dc0c13d373d60982e7cb95168e0167e (diff)
downloadmc-3b5584581a79cec899c7f6a5233529a64a22ab5f.tar.gz
Collect fltXYbfmt parameters into analogue of intparams
Diffstat (limited to 'lib/std/fmt.myr')
-rw-r--r--lib/std/fmt.myr25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/std/fmt.myr b/lib/std/fmt.myr
index 60a9411..540d6d8 100644
--- a/lib/std/fmt.myr
+++ b/lib/std/fmt.myr
@@ -315,10 +315,10 @@ const fallbackfmt = {sb, params, tyenc, ap : valist# -> void
intfmt(sb, intparams(params), false, (val : uint64), 64)
| `Tyflt32:
var val : flt32 = vanext(ap)
- flt32bfmt(sb, val, MNormal, 0)
+ flt32bfmt(sb, fltparams(params), val)
| `Tyflt64:
var val : flt64 = vanext(ap)
- flt64bfmt(sb, val, MNormal, 0)
+ flt64bfmt(sb, fltparams(params), val)
| `Tyvalist:
sbputs(sb, "...")
@@ -448,6 +448,27 @@ const fmtslice = {sb, subap, params
;;
}
+const fltparams = {params
+ var fp : fltparams
+
+ fp = [
+ .mode = MNormal,
+ .prec = 0,
+ ]
+
+ for p : params
+ match p
+ | (opt, arg):
+ std.write(2, "fmt: ")
+ std.write(2, opt)
+ std.write(2, "arg: ")
+ std.write(2, arg)
+ std.die("\nunreachable\n")
+ ;;
+ ;;
+ -> fp
+}
+
type intparams = struct
base : size
padto : size