xref: /plan9-contrib/sys/src/9k/port/print.c (revision 9ef1f84b659abcb917c5c090acbce0772e494f21)
1 #include "u.h"
2 #include "../port/lib.h"
3 #include "mem.h"
4 #include "dat.h"
5 #include "fns.h"
6 
7 static Lock fmtl;
8 
9 void
_fmtlock(void)10 _fmtlock(void)
11 {
12 	lock(&fmtl);
13 }
14 
15 void
_fmtunlock(void)16 _fmtunlock(void)
17 {
18 	unlock(&fmtl);
19 }
20 
21 int
_efgfmt(Fmt *)22 _efgfmt(Fmt*)
23 {
24 	return -1;
25 }
26 
27 int
mregfmt(Fmt * f)28 mregfmt(Fmt* f)
29 {
30 	Mreg mreg;
31 
32 	mreg = va_arg(f->args, Mreg);
33 	if(sizeof(Mreg) == sizeof(uvlong))
34 		return fmtprint(f, "%#16.16llux", (uvlong)mreg);
35 	return fmtprint(f, "%#8.8ux", (uint)mreg);
36 }
37 
38 void
fmtinit(void)39 fmtinit(void)
40 {
41 	quotefmtinstall();
42 	archfmtinstall();
43 }
44