Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
xprintf.c
Go to the documentation of this file.
1/*
2** It turns out that the printf functions in the stock MIT pthread library
3** is busted. It isn't thread safe. If two threads try to do a printf
4** of a floating point value at the same time, a core-dump might result.
5** So this code is substituted.
6*/
7/*
8** NAME: $Source: /open/anoncvs/cvs/src/lib/libpthread/stdio/Attic/xprintf.c,v $
9** VERSION: $Revision: 1.1 $
10** DATE: $Date: 1998/07/21 13:22:19 $
11**
12** ONELINER: A replacement for formatted printing programs.
13**
14** COPYRIGHT:
15** Copyright (c) 1990 by D. Richard Hipp. This code is an original
16** work and has been prepared without reference to any prior
17** implementations of similar functions. No part of this code is
18** subject to licensing restrictions of any telephone company or
19** university.
20**
21** This copyright was released and the code placed in the public domain
22** by the author, D. Richard Hipp, on October 3, 1996.
23**
24** DESCRIPTION:
25** This program is an enhanced replacement for the "printf" programs
26** found in the standard library. The following enhancements are
27** supported:
28**
29** + Additional functions. The standard set of "printf" functions
30** includes printf, fprintf, sprintf, vprintf, vfprintf, and
31** vsprintf. This module adds the following:
32**
33** * snprintf -- Works like sprintf, but has an extra argument
34** which is the size of the buffer written to.
35**
36** * mprintf -- Similar to sprintf. Writes output to memory
37** obtained from mem_alloc.
38**
39** * xprintf -- Calls a function to dispose of output.
40**
41** * nprintf -- No output, but returns the number of characters
42** that would have been output by printf.
43**
44** * A v- version (ex: vsnprintf) of every function is also
45** supplied.
46**
47** + A few extensions to the formatting notation are supported:
48**
49** * The "=" flag (similar to "-") causes the output to be
50** be centered in the appropriately sized field.
51**
52** * The %b field outputs an integer in binary notation.
53**
54** * The %c field now accepts a precision. The character output
55** is repeated by the number of times the precision specifies.
56**
57** * The %' field works like %c, but takes as its character the
58** next character of the format string, instead of the next
59** argument. For example, printf("%.78'-") prints 78 minus
60** signs, the same as printf("%.78c",'-').
61**
62** + When compiled using GCC on a SPARC, this version of printf is
63** faster than the library printf for SUN OS 4.1.
64**
65** + All functions are fully reentrant.
66**
67*/
68/*
69** Undefine COMPATIBILITY to make some slight changes in the way things
70** work. I think the changes are an improvement, but they are not
71** backwards compatible.
72*/
73/* #define COMPATIBILITY / * Compatible with SUN OS 4.1 */
74#include "common/libc/xprintf.h"
75
76#include <stdarg.h>
77#include <stddef.h>
78#include <stdint.h>
79
80#include "common/libc/alloc.h"
81
82static __inline__ int isdigit(int c) { return c >= '0' && c <= '9'; }
83static __inline__ size_t strlen(const char *s) {
84 size_t r = 0;
85 while (*s++) r++;
86 return r;
87}
88
89/*
90** Conversion types fall into various categories as defined by the
91** following enumeration.
92*/
93enum e_type { /* The type of the format field */
94 RADIX, /* Integer types. %d, %x, %o, and so forth */
95 FIXED, /* Fixed point. %f, %e, and %a */
96 SIZE, /* Return number of characters processed so far. %n */
97 STRING, /* Strings. %s */
98 PERCENT, /* Percent symbol. %% */
99 CHAR, /* Characters. %c */
100 ERROR, /* Used to indicate no such conversion type */
101 /* The rest are extensions, not normally found in printf() */
102 CHARLIT, /* Literal characters. %' */
103 SEEIT, /* Strings with visible control characters. %S */
104 MEM_STRING, /* A string which should be deleted after use. %z */
105 ORDINAL, /* 1st, 2nd, 3rd and so forth */
106};
107
108/*
109** Each builtin conversion character (ex: the 'd' in "%d") is described
110** by an instance of the following structure
111*/
112typedef struct s_info { /* Information about each format field */
113 int fmttype; /* The format field code letter */
114 int base; /* The base for radix conversion, or the scale in fixed-point mode */
115 const char *charset; /* The character set for conversion */
116 int flag_signed; /* Is the quantity signed? */
117 const char *prefix; /* Prefix on non-zero values in alt format */
118 enum e_type type; /* Conversion paradigm */
119} info;
120
121/*
122** The following table is searched linearly, so it is good to put the
123** most frequently used conversion types first.
124*/
125static const info fmtinfo[] = {
126 {
127 'd',
128 10,
129 "0123456789",
130 1,
131 0,
132 RADIX,
133 },
134 {
135 's',
136 0,
137 0,
138 0,
139 0,
140 STRING,
141 },
142 {
143 'S',
144 0,
145 0,
146 0,
147 0,
148 SEEIT,
149 },
150 {
151 'z',
152 0,
153 0,
154 0,
155 0,
157 },
158 {
159 'c',
160 0,
161 0,
162 0,
163 0,
164 CHAR,
165 },
166 {
167 'o',
168 8,
169 "01234567",
170 0,
171 "0",
172 RADIX,
173 },
174 {
175 'u',
176 10,
177 "0123456789",
178 0,
179 0,
180 RADIX,
181 },
182 {
183 'x',
184 16,
185 "0123456789abcdef",
186 0,
187 "x0",
188 RADIX,
189 },
190 {
191 'X',
192 16,
193 "0123456789ABCDEF",
194 0,
195 "X0",
196 RADIX,
197 },
198 {
199 'r',
200 10,
201 "0123456789",
202 0,
203 0,
204 ORDINAL,
205 },
206 {
207 'f',
208 4096,
209 0,
210 1,
211 0,
212 FIXED,
213 },
214 {
215 'e',
216 4096,
217 0,
218 0,
219 0,
220 FIXED,
221 },
222 {
223 'a',
224 1024,
225 0,
226 1,
227 0,
228 FIXED,
229 },
230 {
231 'i',
232 10,
233 "0123456789",
234 1,
235 0,
236 RADIX,
237 },
238 {
239 'n',
240 0,
241 0,
242 0,
243 0,
244 SIZE,
245 },
246 {
247 '%',
248 0,
249 0,
250 0,
251 0,
252 PERCENT,
253 },
254 {
255 'b',
256 2,
257 "01",
258 0,
259 "b0",
260 RADIX,
261 }, /* Binary notation */
262 {
263 'p',
264 16,
265 "0123456789abcdef",
266 0,
267 "x0",
268 RADIX,
269 }, /* Pointers */
270 {
271 '\'',
272 0,
273 0,
274 0,
275 0,
276 CHARLIT,
277 }, /* Literal char */
278};
279#define NINFO (sizeof(fmtinfo) / sizeof(info)) /* Size of the fmtinfo table */
280
281/*
282** Setting the size of the BUFFER involves trade-offs. No %d or %f
283** conversion can have more than BUFSIZE characters. If the field
284** width is larger than BUFSIZE, it is silently shortened. On the
285** other hand, this routine consumes more stack space with larger
286** BUFSIZEs. If you have some threads for which you want to minimize
287** stack space, you should keep BUFSIZE small.
288*/
289#define BUFSIZE 100 /* Size of the output buffer */
290
291/*
292** The root program. All variations call this core.
293**
294** INPUTS:
295** func This is a pointer to a function taking three arguments
296** 1. A pointer to the list of characters to be output
297** (Note, this list is NOT null terminated.)
298** 2. An integer number of characters to be output.
299** (Note: This number might be zero.)
300** 3. A pointer to anything. Same as the "arg" parameter.
301**
302** arg This is the pointer to anything which will be passed as the
303** third argument to "func". Use it for whatever you like.
304**
305** fmt This is the format string, as in the usual print.
306**
307** ap This is a pointer to a list of arguments. Same as in
308** vfprint.
309**
310** OUTPUTS:
311** The return value is the total number of characters sent to
312** the function "func". Returns -1 on a error.
313**
314** Note that the order in which automatic variables are declared below
315** seems to make a big difference in determining how fast this beast
316** will run.
317*/
318int vxprintf(void (*func)(const char *, int, void *), void *arg, const char *format, va_list ap) {
319 register const char *fmt; /* The format string. */
320 register int c; /* Next character in the format string */
321 register char *bufpt; /* Pointer to the conversion buffer */
322 register int precision; /* Precision of the current field */
323 register int length; /* Length of the field */
324 register int idx; /* A general purpose loop counter */
325 int count; /* Total number of characters output */
326 int width; /* Width of the current field */
327 int scale; /* Scale factor for fixed-point numbers */
328 int flag_leftjustify; /* True if "-" flag is present */
329 int flag_plussign; /* True if "+" flag is present */
330 int flag_blanksign; /* True if " " flag is present */
331 int flag_alternateform; /* True if "#" flag is present */
332 int flag_zeropad; /* True if field width constant starts with zero */
333 int flag_long; /* True if "l" flag is present */
334 int flag_center; /* True if "=" flag is present */
335 unsigned long longvalue; /* Value for integer types */
336 const info *infop; /* Pointer to the appropriate info structure */
337 char buf[BUFSIZE]; /* Conversion buffer */
338 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
339 int errorflag = 0; /* True if an error is encountered */
340 enum e_type xtype; /* Conversion paradigm */
341 char *zMem = NULL; /* String to be freed */
342 static const char spaces[] = " ";
343#define SPACESIZE (sizeof(spaces) - 1)
344
345 fmt = format; /* Put in a register for speed */
346 count = length = 0;
347 bufpt = 0;
348 for (; (c = (*fmt)) != 0; ++fmt) {
349 if (c != '%') {
350 register int amt;
351 bufpt = (char *)fmt;
352 amt = 1;
353 while ((c = (*++fmt)) != '%' && c != 0) amt++;
354 (*func)(bufpt, amt, arg);
355 count += amt;
356 if (c == 0) break;
357 }
358 if ((c = (*++fmt)) == 0) {
359 errorflag = 1;
360 (*func)("%", 1, arg);
361 count++;
362 break;
363 }
364 /* Find out what flags are present */
365 flag_leftjustify = flag_plussign = flag_blanksign = flag_alternateform = flag_zeropad = flag_center = 0;
366 do {
367 switch (c) {
368 case '-':
369 flag_leftjustify = 1;
370 c = 0;
371 break;
372 case '+':
373 flag_plussign = 1;
374 c = 0;
375 break;
376 case ' ':
377 flag_blanksign = 1;
378 c = 0;
379 break;
380 case '#':
381 flag_alternateform = 1;
382 c = 0;
383 break;
384 case '0':
385 flag_zeropad = 1;
386 c = 0;
387 break;
388 case '=':
389 flag_center = 1;
390 c = 0;
391 break;
392 default:
393 break;
394 }
395 } while (c == 0 && (c = (*++fmt)) != 0);
396 if (flag_center) flag_leftjustify = 0;
397 /* Get the field width */
398 width = 0;
399 if (c == '*') {
400 width = va_arg(ap, int);
401 if (width < 0) {
402 flag_leftjustify = 1;
403 width = -width;
404 }
405 c = *++fmt;
406 } else {
407 while (isdigit(c)) {
408 width = width * 10 + c - '0';
409 c = *++fmt;
410 }
411 }
412 if (width > BUFSIZE - 10) {
413 width = BUFSIZE - 10;
414 }
415 /* Get the precision */
416 if (c == '.') {
417 precision = 0;
418 c = *++fmt;
419 if (c == '*') {
420 precision = va_arg(ap, int);
421#ifndef COMPATIBILITY
422 /* This is sensible, but SUN OS 4.1 doesn't do it. */
423 if (precision < 0) precision = -precision;
424#endif
425 c = *++fmt;
426 } else {
427 while (isdigit(c)) {
428 precision = precision * 10 + c - '0';
429 c = *++fmt;
430 }
431 }
432 /* Limit the precision to prevent overflowing buf[] during conversion */
433 if (precision > BUFSIZE - 40) precision = BUFSIZE - 40;
434 } else {
435 precision = -1;
436 }
437 /* Get the scale factor */
438 if (c == '/') {
439 scale = 0;
440 c = *++fmt;
441 while (isdigit(c)) {
442 scale = scale * 10 + c - '0';
443 c = *++fmt;
444 }
445 } else {
446 scale = -1;
447 }
448 /* Get the conversion type modifier */
449 if (c == 'l') {
450 flag_long = 1;
451 c = *++fmt;
452 } else {
453 flag_long = 0;
454 }
455 /* Fetch the info entry for the field */
456 infop = 0;
457 for (idx = 0; idx < NINFO; idx++) {
458 if (c == fmtinfo[idx].fmttype) {
459 infop = &fmtinfo[idx];
460 break;
461 }
462 }
463 /* No info entry found. It must be an error. */
464 if (infop == 0) {
465 xtype = ERROR;
466 } else {
467 xtype = infop->type;
468 if (c == 'p') {
469 flag_alternateform = 1;
470 width = sizeof(uintptr_t) * 2;
471 }
472 }
473
474 /*
475 ** At this point, variables are initialized as follows:
476 **
477 ** flag_alternateform TRUE if a '#' is present.
478 ** flag_plussign TRUE if a '+' is present.
479 ** flag_leftjustify TRUE if a '-' is present or if the
480 ** field width was negative.
481 ** flag_zeropad TRUE if the width began with 0.
482 ** flag_long TRUE if the letter 'l' (ell) prefixed
483 ** the conversion character.
484 ** flag_blanksign TRUE if a ' ' is present.
485 ** width The specified field width. This is
486 ** always non-negative. Zero is the default.
487 ** precision The specified precision. The default
488 ** is -1.
489 ** scale The scale factor for fixed-point
490 ** conversions. The default is 4096.
491 ** xtype The class of the conversion.
492 ** infop Pointer to the appropriate info struct.
493 */
494 switch (xtype) {
495 case ORDINAL:
496 case RADIX:
497 case FIXED:
498 if (flag_long)
499 longvalue = va_arg(ap, long);
500 else
501 longvalue = va_arg(ap, int);
502#ifdef COMPATIBILITY
503 /* For the format %#x, the value zero is printed "0" not "0x0".
504 ** I think this is stupid. */
505 if (longvalue == 0) flag_alternateform = 0;
506#else
507 /* More sensible: turn off the prefix for octal (to prevent "00"),
508 ** but leave the prefix for hex. */
509 if (longvalue == 0 && infop->base == 8) flag_alternateform = 0;
510#endif
511 if (infop->flag_signed) {
512 if (*(long *)&longvalue < 0) {
513 longvalue = -*(long *)&longvalue;
514 prefix = '-';
515 } else if (flag_plussign)
516 prefix = '+';
517 else if (flag_blanksign)
518 prefix = ' ';
519 else
520 prefix = 0;
521 } else
522 prefix = 0;
523 if (flag_zeropad && precision < width - (prefix != 0)) {
524 precision = width - (prefix != 0);
525 }
526 bufpt = &buf[BUFSIZE];
527 if (xtype == ORDINAL) {
528 long a, b;
529 a = longvalue % 10;
530 b = longvalue % 100;
531 bufpt -= 2;
532 if (a == 0 || a > 3 || (b > 10 && b < 14)) {
533 bufpt[0] = 't';
534 bufpt[1] = 'h';
535 } else if (a == 1) {
536 bufpt[0] = 's';
537 bufpt[1] = 't';
538 } else if (a == 2) {
539 bufpt[0] = 'n';
540 bufpt[1] = 'd';
541 } else if (a == 3) {
542 bufpt[0] = 'r';
543 bufpt[1] = 'd';
544 }
545 }
546 if (xtype == FIXED) {
547 if (scale < 0) scale = infop->base;
548 unsigned long integer = longvalue / scale;
549 unsigned long fractional = longvalue - (integer * scale);
550 register const char *cset;
551 cset = infop->charset;
552 if (precision < 0) precision = 6;
553 bufpt -= precision;
554 char *end = bufpt;
555 for (idx = precision; idx > 0; idx--) {
556 fractional *= 10;
557 uint32_t copy = fractional;
558 copy /= scale;
559 fractional -= copy * scale;
560 *(end++) = (copy % 10) + '0';
561 }
562 *(--bufpt) = '.';
563 do {
564 *(--bufpt) = (integer % 10) + '0';
565 integer = integer / 10;
566 } while (integer > 0);
567 } else {
568 register const char *cset; /* Use registers for speed */
569 register int base;
570 cset = infop->charset;
571 base = infop->base;
572 do { /* Convert to ascii */
573 *(--bufpt) = cset[longvalue % base];
574 longvalue = longvalue / base;
575 } while (longvalue > 0);
576 }
577 length = (int)(&buf[BUFSIZE] - bufpt);
578 for (idx = precision - length; idx > 0; idx--) {
579 *(--bufpt) = '0'; /* Zero pad */
580 }
581 if (prefix) *(--bufpt) = prefix; /* Add sign */
582 if (flag_alternateform && infop->prefix) { /* Add "0" or "0x" */
583 const char *pre;
584 char x;
585 pre = infop->prefix;
586 if (*bufpt != pre[0]) {
587 for (pre = infop->prefix; (x = (*pre)) != 0; pre++) *(--bufpt) = x;
588 }
589 }
590 length = (int)(&buf[BUFSIZE] - bufpt);
591 break;
592 case SIZE:
593 *(va_arg(ap, int *)) = count;
594 length = width = 0;
595 break;
596 case PERCENT:
597 buf[0] = '%';
598 bufpt = buf;
599 length = 1;
600 break;
601 case CHARLIT:
602 case CHAR:
603 c = buf[0] = (xtype == CHAR ? va_arg(ap, int) : *++fmt);
604 if (precision >= 0) {
605 for (idx = 1; idx < precision; idx++) buf[idx] = c;
606 length = precision;
607 } else {
608 length = 1;
609 }
610 bufpt = buf;
611 break;
612 case STRING:
613 case MEM_STRING:
614 zMem = bufpt = va_arg(ap, char *);
615 if (bufpt == 0) bufpt = "(null)";
616 length = strlen(bufpt);
617 if (precision >= 0 && precision < length) length = precision;
618 break;
619 case SEEIT: {
620 int i;
621 int c;
622 char *arg = va_arg(ap, char *);
623 for (i = 0; i < BUFSIZE - 1 && (c = *arg++) != 0; i++) {
624 if (c < 0x20 || c >= 0x7f) {
625 buf[i++] = '^';
626 buf[i] = (c & 0x1f) + 0x40;
627 } else {
628 buf[i] = c;
629 }
630 }
631 bufpt = buf;
632 length = i;
633 if (precision >= 0 && precision < length) length = precision;
634 } break;
635 case ERROR:
636 buf[0] = '%';
637 buf[1] = c;
638 errorflag = 0;
639 idx = 1 + (c != 0);
640 (*func)("%", idx, arg);
641 count += idx;
642 if (c == 0) fmt--;
643 break;
644 } /* End switch over the format type */
645 /*
646 ** The text of the conversion is pointed to by "bufpt" and is
647 ** "length" characters long. The field width is "width". Do
648 ** the output.
649 */
650 if (!flag_leftjustify) {
651 register int nspace;
652 nspace = width - length;
653 if (nspace > 0) {
654 if (flag_center) {
655 nspace = nspace / 2;
656 width -= nspace;
657 flag_leftjustify = 1;
658 }
659 count += nspace;
660 while (nspace >= SPACESIZE) {
661 (*func)(spaces, SPACESIZE, arg);
662 nspace -= SPACESIZE;
663 }
664 if (nspace > 0) (*func)(spaces, nspace, arg);
665 }
666 }
667 if (length > 0) {
668 (*func)(bufpt, length, arg);
669 count += length;
670 }
671#ifndef XPRINTFNOALLOC
672 if (xtype == MEM_STRING && zMem) {
673 libc_free(zMem);
674 }
675#endif
676 if (flag_leftjustify) {
677 register int nspace;
678 nspace = width - length;
679 if (nspace > 0) {
680 count += nspace;
681 while (nspace >= SPACESIZE) {
682 (*func)(spaces, SPACESIZE, arg);
683 nspace -= SPACESIZE;
684 }
685 if (nspace > 0) (*func)(spaces, nspace, arg);
686 }
687 }
688 } /* End for loop over the format string */
689 return errorflag ? -1 : count;
690} /* End of function */
691
692/*
693** Now for string-print, also as found in any standard library.
694** Add to this the snprint function which stops added characters
695** to the string at a given length.
696**
697** Note that snprint returns the length of the string as it would
698** be if there were no limit on the output.
699*/
700struct s_strargument { /* Describes the string being written to */
701 char *next; /* Next free slot in the string */
702 char *last; /* Last available slot in the string */
703};
704
705static void sout(const char *txt, int amt, void *arg) {
706 register char *head;
707 register const char *t;
708 register int a;
709 register char *tail;
710 a = amt;
711 t = txt;
712 head = ((struct s_strargument *)arg)->next;
713 tail = ((struct s_strargument *)arg)->last;
714 if (tail) {
715 while (a-- > 0 && head < tail) *(head++) = *(t++);
716 } else {
717 while (a-- > 0) *(head++) = *(t++);
718 }
719 *head = 0;
720 ((struct s_strargument *)arg)->next = head;
721}
722
723int vsprintf(char *buf, const char *fmt, va_list ap) {
724 struct s_strargument arg;
725 arg.next = buf;
726 arg.last = 0;
727 *buf = 0;
728 return vxprintf(sout, &arg, fmt, ap);
729}
730int vsnprintf(char *buf, size_t n, const char *fmt, va_list ap) {
731 struct s_strargument arg;
732 arg.next = buf;
733 arg.last = &buf[n - 1];
734 *buf = 0;
735 return vxprintf(sout, &arg, fmt, ap);
736}
737
738#ifndef XPRINTFNOALLOC
739/*
740** The following section of code handles the mprintf routine, that
741** writes to memory obtained from malloc().
742*/
743
744/* This structure is used to store state information about the
745** write in progress
746*/
747struct sgMprintf {
748 char *zBase; /* A base allocation */
749 char *zText; /* The string collected so far */
750 int nChar; /* Length of the string so far */
751 int nAlloc; /* Amount of space allocated in zText */
752};
753
754/* The xprintf callback function. */
755static void mout(const char *zNewText, int nNewChar, void *arg) {
756 struct sgMprintf *pM = (struct sgMprintf *)arg;
757 if (pM->nChar + nNewChar + 1 > pM->nAlloc) {
758 pM->nAlloc = pM->nChar + nNewChar * 2 + 1;
759 if (pM->zText == pM->zBase) {
760 pM->zText = libc_malloc(pM->nAlloc);
761 if (pM->zText && pM->nChar) __builtin_memcpy(pM->zText, pM->zBase, pM->nChar);
762 } else {
763 pM->zText = libc_realloc(pM->zText, pM->nAlloc);
764 }
765 }
766 if (pM->zText) {
767 __builtin_memcpy(&pM->zText[pM->nChar], zNewText, nNewChar);
768 pM->nChar += nNewChar;
769 pM->zText[pM->nChar] = 0;
770 }
771}
772
773/*
774** mprintf() works like printf(), but allocations memory to hold the
775** resulting string and returns a pointer to the allocated memory.
776**
777** We changed the name to TclMPrint() to conform with the Tcl private
778** routine naming conventions.
779*/
780
781/* This is the varargs version of mprintf.
782**
783** The name is changed to TclVMPrintf() to conform with Tcl naming
784** conventions.
785*/
786int vasprintf(char **out, const char *zFormat, va_list ap) {
787 struct sgMprintf sMprintf;
788 char zBuf[200];
789 int r;
790 sMprintf.nChar = 0;
791 sMprintf.zText = zBuf;
792 sMprintf.nAlloc = sizeof(zBuf);
793 sMprintf.zBase = zBuf;
794 r = vxprintf(mout, &sMprintf, zFormat, ap);
795 if (sMprintf.zText == sMprintf.zBase) {
796 sMprintf.zText = libc_malloc(strlen(zBuf) + 1);
797 if (sMprintf.zText) __builtin_strcpy(sMprintf.zText, zBuf);
798 } else {
799 sMprintf.zText = libc_realloc(sMprintf.zText, sMprintf.nChar + 1);
800 }
801 *out = sMprintf.zText;
802 return r;
803}
804#endif
void * libc_realloc(void *ptr_, size_t size_)
Re-allocates memory from the heap.
Definition alloc.c:481
#define head
Definition alloc.c:111
void * libc_malloc(size_t size_)
Allocates memory from the heap.
Definition alloc.c:248
void libc_free(void *ptr_)
Frees memory from the heap.
Definition alloc.c:357
e_type
Definition xprintf.c:93
@ ERROR
Definition xprintf.c:100
@ PERCENT
Definition xprintf.c:98
@ ORDINAL
Definition xprintf.c:105
@ SEEIT
Definition xprintf.c:103
@ MEM_STRING
Definition xprintf.c:104
@ CHAR
Definition xprintf.c:99
@ SIZE
Definition xprintf.c:96
@ CHARLIT
Definition xprintf.c:102
@ RADIX
Definition xprintf.c:94
@ FIXED
Definition xprintf.c:95
@ STRING
Definition xprintf.c:97
int vsprintf(char *buf, const char *fmt, va_list ap)
Prints a formatted string to a string.
Definition xprintf.c:723
#define NINFO
Definition xprintf.c:279
int vasprintf(char **out, const char *zFormat, va_list ap)
Prints a formatted string to a newly allocated string.
Definition xprintf.c:786
struct s_info info
Definition syscalls.h:517
int vxprintf(void(*func)(const char *, int, void *), void *arg, const char *format, va_list ap)
Prints a formatted string to a callback.
Definition xprintf.c:318
#define BUFSIZE
Definition xprintf.c:289
#define SPACESIZE
int vsnprintf(char *buf, size_t n, const char *fmt, va_list ap)
Prints a formatted string to a length-limited string.
Definition xprintf.c:730
uint32_t t
Definition cop0.c:79
uint32_t r
Definition cpu.c:222
uint32_t out
Definition cpu.c:62
int format(const char *deviceName)
Definition filesystem.c:60
uint8_t b
Definition gte-depthcue.c:39
int i
Definition gte-regio.c:297
char * s
Definition string.c:48
Definition xprintf.c:112
int fmttype
Definition xprintf.c:113
const char * prefix
Definition xprintf.c:117
int flag_signed
Definition xprintf.c:116
const char * charset
Definition xprintf.c:115
int base
Definition xprintf.c:114
enum e_type type
Definition xprintf.c:118
Definition xprintf.c:700
char * next
Definition xprintf.c:701
char * last
Definition xprintf.c:702
Definition xprintf.c:747
int nChar
Definition xprintf.c:750
char * zText
Definition xprintf.c:749
int nAlloc
Definition xprintf.c:751
char * zBase
Definition xprintf.c:748
static size_t size_t width
Definition syscalls.h:158
static const void size_t count
Definition syscalls.h:146
static int c
Definition syscalls.h:122
static const void * buf
Definition syscalls.h:61
void int(code1, code2)
void uint32_t(classId, spec)