aboutsummaryrefslogtreecommitdiff
path: root/fmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'fmt.c')
-rw-r--r--fmt.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/fmt.c b/fmt.c
new file mode 100644
index 0000000..359b4ba
--- /dev/null
+++ b/fmt.c
@@ -0,0 +1,28 @@
+#include <u.h>
+#include <libc.h>
+#include <geometry.h>
+
+int
+vfmt(Fmt *f)
+{
+ Point2 p;
+
+ p = va_arg(f->args, Point2);
+ return fmtprint(f, "[%g %g %g]", p.x, p.y, p.w);
+}
+
+int
+Vfmt(Fmt *f)
+{
+ Point3 p;
+
+ p = va_arg(f->args, Point3);
+ return fmtprint(f, "[%g %g %g %g]", p.x, p.y, p.z, p.w);
+}
+
+void
+GEOMfmtinstall(void)
+{
+ fmtinstall('v', vfmt);
+ fmtinstall('V', Vfmt);
+}