ref: ecd40a88198f1a03b0e87a4f3066f944f09cf0d8
dir: /misc.c/
#include <u.h> #include <libc.h> #include <bio.h> #include "pdf.h" static char *otypes[] = { [Obool] = "bool", [Onum] = "num", [Ostr] = "str", [Oname] = "name", [Oarray] = "array", [Odict] = "dict", [Ostream] = "stream", [Onull] = "null", [Oindir] = "indir", }; Object null = { .type = Onull, }; int Tfmt(Fmt *f) { Object *o; o = va_arg(f->args, Object*); if(o == nil || o == &null) return fmtprint(f, "null"); if(o->type < 0 || o->type >= nelem(otypes)) return fmtprint(f, "????"); return fmtprint(f, "%s", otypes[o->type]); } int isws(int c) { return /* \0 is missing on purpose */ c == '\t' || c == '\n' || c == '\f' || c == '\r' || c == ' '; } int isdelim(int c) { return c == '(' || c == ')' || c == '<' || c == '>' || c == '[' || c == ']' || c == '{' || c == '}' || c == '/' || c == '%'; }