jehanne/sys/src/kern/port/print.c

50 lines
792 B
C

/* Copyright (C) Charles Forsyth
* See /doc/license/NOTICE.Plan9-9k.txt for details about the licensing.
*/
/* Portions of this file are Copyright (C) 2015-2018 Giacomo Tesio <giacomo@tesio.it>
* See /doc/license/gpl-2.0.txt for details about the licensing.
*/
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
static Lock fmtl;
void
_fmtlock(void)
{
lock(&fmtl);
}
void
_fmtunlock(void)
{
unlock(&fmtl);
}
int
_efgfmt(Fmt* _1)
{
return -1;
}
int
mregfmt(Fmt* f)
{
Mreg mreg;
mreg = va_arg(f->args, Mreg);
if(sizeof(Mreg) == sizeof(uint64_t))
return jehanne_fmtprint(f, "%#16.16llux", (uint64_t)mreg);
return jehanne_fmtprint(f, "%#8.8ux", (uint32_t)mreg);
}
void
fmtinit(void)
{
jehanne_quotefmtinstall();
// archfmtinstall();
}