1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
4 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
5 <TITLE>SDCC Compiler User Guide: Library routines.</TITLE>
6 <LINK HREF="SDCCUdoc-20.html" REL=next>
7 <LINK HREF="SDCCUdoc-18.html" REL=previous>
8 <LINK HREF="SDCCUdoc.html#toc19" REL=contents>
11 <A HREF="SDCCUdoc-20.html">Next</A>
12 <A HREF="SDCCUdoc-18.html">Previous</A>
13 <A HREF="SDCCUdoc.html#toc19">Contents</A>
15 <H2><A NAME="Library"></A> <A NAME="s19">19. Library routines.</A> </H2>
17 <P>The following library routines are provided for your convenience.
18 <P><B>stdio.h </B>- Contains the following functions printf & sprintf these routines
19 are developed by Martijn van Balen <balen@natlab.research.philips.com>.
23 %[flags][width][b|B|l|L]type flags: - left justify output in specified field width
25 + prefix output with +/- sign if output is signed
27 space prefix output with a blank if it's a signed
29 width: specifies minimum number of characters
33 - For numbers, spaces are added on the left when needed.
35 If width starts with a zero character, zeroes and used
38 - For strings, spaces are are
39 added on the left or right (when
44 (used by d, u, o, x, X)
45 l/L: long argument (used by d,
47 type: d decimal number
49 unsigned decimal number
50 o unsigned octal number
52 x unsigned hexadecimal number (0-9, a-f)
54 unsigned hexadecimal number (0-9, A-F)
57 s string (generic pointer)
59 generic pointer (I:data/idata, C:code, X:xdata, P:paged)
61 f float (still to be implemented)
64 <P>Also contains a very simple version of printf (<B>printf_small</B>). This simplified
65 version of printf supports only the following formats.
68 format output type argument-type <bf>
72 %hd decimal short/char
77 %hx hexadecimal short/char
83 %c character char/short
86 <p><tt>The routine is <tt><bf>very stack intesive , --stack-after-data parameter should
87 be used when using this routine, the routine also takes about 1K of code space
88 .It also expects an external function named putchar(char ) to be present (this
89 can be changed). When using the %s format the string / pointer should
90 be cast to a generic pointer. eg.
94 <A HREF="SDCCUdoc-20.html">Next</A>
95 <A HREF="SDCCUdoc-18.html">Previous</A>
96 <A HREF="SDCCUdoc.html#toc19">Contents</A>