added libdoc.txt
[fw/sdcc] / doc / libdoc.txt
1 Not finished - 19 Jan 2002 - checkpoint (Steve Kenton)
2
3 This is a sorted (ignoring leading '_') list of the SDCC library.
4 Sources are in ~sdcc/device/lib/*.c and ~sdcc/device/include/*.h.
5 Except where denoted with MACRO these are implemented as functions.
6 Internal function calls are generated by the compiler to implement
7 IEEE floating point, etc.  They are not normally called directly.
8
9 ctype.h
10 /*-------------------------------------------------------------------------
11
12 isalnum - character classification - #include <ctype.h> - all ports
13         char isalnum (unsigned char c); MACRO
14         Return true if c is an ASCII letter or digit
15         'a-z','A-Z', '0'-'9' otherwise return false.
16
17 isalpha - character classification - #include <ctype.h> - all ports
18         char isalpha (unsigned char c); MACRO
19         Return true if c is an ASCII letter
20         'a-z','A-Z' otherwise return false.
21
22 iscntrl - character classification - #include <ctype.h> - all ports
23         char iscntrl (unsigned char c);
24         Return true if c is an ASCII control character
25         0x00-0x1F or 0x7F (DEL) otherwise return false.
26
27 isdigit - character classification - #include <ctype.h> - all ports
28         char isdigit (unsigned char c);
29         Return true if c is an ASCII digit '0'-'9'
30         otherwise return false.
31
32 isgraph - character classification - #include <ctype.h> - all ports
33         char isgraph (unsigned char c);
34         Return true is c is an ASCII printable graphic
35         excluding space 0x21-0x7E otherwise return false.
36
37 islower - character classification - #include <ctype.h> - all ports
38         char islower (unsigned char c);
39         Return true if c is an ASCII lower case letter
40         'a'-'z' otherwise return false.
41
42 isprint - character classification - #include <ctype.h> - all ports
43         char isprint (unsigned char c);
44         Return true is c is an ASCII printable graphic
45         including space 0x20-0x7E otherwise return false.
46
47 ispunct - character classification - #include <ctype.h> - all ports
48         char ispunct (unsigned char c);
49         Return true if c is ASCII punctuation (isgraph but not isalnum)
50         otherwise return false.
51
52 isspace - character classification - #include <ctype.h> - all ports
53         char isspace (unsigned char c);
54         Return true if c is an ASCII white space character
55         space, tab, carriage return, newline or vertical tab
56         0x09-0x0D, 0x20 otherwise return false.
57
58 isupper - character classification - #include <ctype.h> - all ports
59         char isupper (unsigned char c);
60         Return true if c is an ASCII upper case letter
61         'A'-'Z' otherwise return false.
62
63 isxdigit - character classification - #include <ctype.h> - all ports
64         char isxdigit (unsigned char c);
65         Return true if c is an ASCII hexidecimal digit
66         '0-9','a-f','A-F' otherwise return false.
67
68 toascii - character classification - #include <ctype.h> - all ports
69         char toascii(unsigned char c); MACRO
70         Convert c from 8-bit to 7-bit ASCII.
71
72 tolower - character classification - #include <ctype.h> - all ports
73         char _tolower(unsigned char c); MACRO
74         char tolower(unsigned char c); MACRO
75         Convert c from upper case to lower case.
76
77 toupper - character classification - #include <ctype.h> - all ports
78         char _toupper(unsigned char c); MACRO
79         char toupper(unsigned char c); MACRO
80         Convert c from lower case to upper case.
81
82 float.h
83 /*-------------------------------------------------------------------------
84
85 __uchar2fs - IEEE single precision math - #include <float.h> - ??? ports
86         float __uchar2fs (unsigned char uc); INTERNAL
87         Convert an unsigned char to float.
88
89 __schar2fs - IEEE single precision math - #include <float.h> - ??? ports
90         float __schar2fs (signed char sc); INTERNAL
91         Convert a signed char to float.
92
93 __uint2fs - IEEE single precision math - #include <float.h> - ??? ports
94         float __uint2fs (unsigned int ui); INTERNAL
95         Convert an unsigned int to float.
96
97 __sint2fs - IEEE single precision math - #include <float.h> - ??? ports
98         float __sint2fs (signed int si); INTERNAL
99         Convert a signed int to float.
100
101 __ulong2fs - IEEE single precision math - #include <float.h> - ??? ports
102         float __ulong2fs (unsigned long ul); INTERNAL
103         Convert an unsigned log to float.
104
105 __slong2fs - IEEE single precision math - #include <float.h> - ??? ports
106         float __slong2fs (signed long sl); INTERNAL
107         Convert a signed long to float.
108
109 __fs2uchar - IEEE single precision math - #include <float.h> - ??? ports
110         unsigned char __fs2uchar (float f); INTERNAL
111         Convert a float to unsigned char;
112
113 __fs2schar - IEEE single precision math - #include <float.h> - ??? ports
114         signed char __fs2schar (float f); INTERNAL
115         Convert a float to signed char;
116
117 __fs2uint - IEEE single precision math - #include <float.h> - ??? ports
118         unsigned int __fs2uint (float f); INTERNAL
119         Convert a float to unsigned int;
120
121 __fs2sint - IEEE single precision math - #include <float.h> - ??? ports
122         signed int __fs2sint (float f); INTERNAL
123         Convert a float to signed int;
124
125 __fs2ulong - IEEE single precision math - #include <float.h> - ??? ports
126         unsigned long __fs2ulong (float f); INTERNAL
127         Convert a float to unsigned long;
128
129 __fs2slong - IEEE single precision math - #include <float.h> - ??? ports
130         signed long __fs2slong (float f); INTERNAL
131         Convert a float to signed long.
132
133 __fsadd - IEEE single precision math - #include <float.h> - ??? ports
134         float __fsadd (float a1, float a2); INTERNAL
135         Add two floats.
136
137 __fssub - IEEE single precision math - #include <float.h> - ??? ports
138         float __fssub (float a1, float a2); INTERNAL
139         Subtract two floats.
140
141 __fsmul - IEEE single precision math - #include <float.h> - ??? ports
142         float __fsmul (float a1, float a2); INTERNAL
143         Multiply two floats.
144
145 __fsdiv - IEEE single precision math - #include <float.h> - ??? ports
146         float __fsdiv (float a1, float a2); INTERNAL
147         Divide two floats.
148
149 __fslt - IEEE single precision math - #include <float.h> - ??? ports
150         char __fslt (float a1, float a2); INTERNAL
151         Compare two floats lt.
152
153 __fseq - IEEE single precision math - #include <float.h> - ??? ports
154         char __fseq (float a1, float a2); INTERNAL
155         Compare two floats eq.
156
157 __fsneq - IEEE single precision math - #include <float.h> - ??? ports
158         char __fseq (float a1, float a2); INTERNAL ??? missing in float.h ???
159         Compare two floats neq.
160
161 __fsgt - IEEE single precision math - #include <float.h> - ??? ports
162         char __fsgt (float a1, float a2); INTERNAL ??? typo in float.h ???
163         Compare two floats gt.
164
165 malloc.h
166 /*-------------------------------------------------------------------------
167 malloc - memory allocation - #include <malloc.h> - ??? ports
168         void *malloc (unsigned int);
169         void xdata * malloc (unsigned int );
170         Allocate a block of memory from the heap;
171
172 free - memory allocation - #include <malloc.h> - ??? ports
173         void free (void *p);
174         void free (void xdata *  p);
175         Return previously allocated memory to the heap.
176
177 init_dynamic_memory - memory allocation - #include <malloc.h> - ??? ports
178         void init_dynamic_memory (MEMHEADER xdata *  , unsigned int );
179         Initialize the memory allocation system.
180
181 math.h
182 /*-------------------------------------------------------------------------
183
184 /* Trigonometric functions */
185 sincosf - ANSI C math - #include <math.h> - all ports
186         float sincosf(const float x, const int iscos); INTERNAL
187         Compute the sine or cosine of x.
188
189 tancotf - ANSI C math - #include <math.h> - all ports
190         float tancotf(const float x, const int iscot); INTERNAL
191         Compute the tangent or cotangent of x.
192
193 asincosf - ANSI C math - #include <math.h> - all ports
194         float asincosf(const float x, const int isacos); INTERNAL
195         Compute the arc sine or arc cosine of x.
196
197 sincoshf - ANSI C math - #include <math.h> - all ports
198         float sincoshf(const float x, const int iscosh); INTERNAL
199         Compute the hyperbolic sine or hyperbolic cosine of x.
200
201 sinf - ANSI C math - #include <math.h> - all ports
202         float sinf (const float x);
203         Compute sine of x.
204
205 cosf - ANSI C math - #include <math.h> - all ports
206         float cosf (const float x);
207         Compute cosine of x.
208
209 tanf - ANSI C math - #include <math.h> - all ports
210         float tanf (const float x);
211         Compute tangent of x.
212
213 cotf - ANSI C math - #include <math.h> - all ports
214         float cotf (const float x);
215         Compute cotangent of x.
216
217 asinf - ANSI C math - #include <math.h> - all ports
218         float asinf (const float x);
219         Compute the arc sine of x.
220
221 acosf - ANSI C math - #include <math.h> - all ports
222         float acosf (const float x);
223         Compute the arc cosine of x.
224
225 atanf - ANSI C math - #include <math.h> - all ports
226         float atanf (const float x);
227         Compute the arc tangent of x.
228
229 atan2f - ANSI C math - #include <math.h> - all ports
230         float atan2f (const float x, const float y); ??? x,y reversed ???
231         Compute the arc tangent of (x/y);
232
233 /* Hyperbolic functions */
234 sinhf - ANSI C math - #include <math.h> - all ports
235         float sinhf (const float x);
236         Compute the hyperbolic sine of x.
237
238 coshf - ANSI C math - #include <math.h> - all ports
239         float coshf (const float x);
240         Compute the hyperbolic cosine of x.
241
242 tanhf - ANSI C math - #include <math.h> - all ports
243         float tanhf (const float x);
244         Compute the hyperbolic tangent of x.
245
246 /* Exponential, logarithmic and power functions */
247 expf - ANSI C math - #include <math.h> - all ports
248         float expf (const float x);
249         Compute e to the x power.
250
251 logf - ANSI C math - #include <math.h> - all ports
252         float logf (const float x);
253         Compute log base e of x.
254
255 log10f - ANSI C math - #include <math.h> - all ports
256         float log10f (const float x);
257         Compute log base 10 of x.
258
259 powf - ANSI C math - #include <math.h> - all ports
260         float powf (const float x, const float y);
261         Compute x to y power.
262
263 sqrtf - ANSI C math - #include <math.h> - all ports
264         float sqrtf (const float x);
265         Compute the square root of x.
266
267 /* Nearest integer, absolute value, and remainder functions */
268 fabsf - ANSI C math - #include <math.h> - all ports
269         float fabsf (const float x);
270         Compute the absolute value of x.
271
272 frexpf - ANSI C math - #include <math.h> - all ports
273         float frexpf (const float x, int *pw2);
274         Split x in to mantissa and exponent parts.
275
276 ldexpf - ANSI C math - #include <math.h> - all ports
277         float ldexpf (const float x, const int pw2);
278         Combine mantissa and exponent parts of a float.
279
280 ceilf - ANSI C math - #include <math.h> - all ports
281         float ceilf (float x);
282         Find the smallest integer not less than x.
283
284 floorf - ANSI C math - #include <math.h> - all ports
285         float floorf (float x);
286         Find the largest integer not more than x.
287
288 modff - ANSI C math - #include <math.h> - all ports
289         float modff (float x, float * y);
290         Split x in to integer and fractional parts.
291
292 setjmp.h
293 /*-------------------------------------------------------------------------
294 setjmp - long jump - #include <setjmp.h> - ??? ports
295         int setjmp (unsigned char * jmpb);
296         Save the return address and sufficient task state
297         to allow implementation of co-routines or error
298         handlers that unwind the stack using longjmp.
299         Returns 0, which is reserved and cannot be used
300         by longjmp.
301
302 longjmp - long jump - #include <setjmp.h> - ??? ports
303         int longjmp (unsigned char * jmpb, int retval);
304         Return to the the location and task state previously
305         save in the jump buffer.  Any integer number except 0
306         may be passed as retval.
307
308 stdio.h
309 /*-------------------------------------------------------------------------
310 printf_small - standard character I/O - #include <stdio.h> - all ports
311         void printf_small (char *,...);
312
313 printf - standard character I/O - #include <stdio.h> - all ports
314         int printf (const char *,...);
315
316 vprintf - standard character I/O - #include <stdio.h> - all ports
317         int vprintf (const char *, va_list);
318
319 sprintf - standard character I/O - #include <stdio.h> - all ports
320         int sprintf (const char *, const char *, ...);
321
322 vsprintf - standard character I/O - #include <stdio.h> - all ports
323         int vsprintf (const char *, const char *, va_list);
324
325 puts - standard character I/O - #include <stdio.h> - all ports
326         int puts(const char *);
327
328 gets - standard character I/O - #include <stdio.h> - all ports
329         char *gets(char *);
330
331 getchar - standard character I/O - #include <stdio.h> - all ports
332         char getchar(void);
333
334 putchar - standard character I/O - #include <stdio.h> - all ports
335         void putchar(char);
336
337 string.h
338 /*-------------------------------------------------------------------------
339 strcpy - string manipulation - #include <string.h> - all ports
340         char *strcpy (char * d, char * s);
341         Copy the source string s to the destination string d.
342
343 strncpy - string manipulation - #include <string.h> - all ports
344         char *strncpy(char * d, char * s, int n);
345
346 strcat - string manipulation - #include <string.h> - all ports
347         char *strcat (char * front, char * back);
348
349 strncat - string manipulation - #include <string.h> - all ports
350         char *strncat(char * front, char * back, int n);
351
352 strcmp - string manipulation - #include <string.h> - all ports
353         int   strcmp (char * asrc, char * adst);
354
355 strncmp - string manipulation - #include <string.h> - all ports
356         int   strncmp(char * asrc, char * adst, int n);
357
358 strchr - string manipulation - #include <string.h> - all ports
359         char *strchr (char *, char  );
360
361 strrchr - string manipulation - #include <string.h> - all ports
362         char *strrchr(char *, char  );
363
364 strspn - string manipulation - #include <string.h> - all ports
365         int   strspn (char *, char *);
366
367 strcspn - string manipulation - #include <string.h> - all ports
368         int   strcspn(char *, char *);
369
370 strpbrk - string manipulation - #include <string.h> - all ports
371         char *strpbrk(char *, char *);
372
373 strstr - string manipulation - #include <string.h> - all ports
374         char *strstr (char *, char *);
375
376 strlen - string manipulation - #include <string.h> - all ports
377         int   strlen (char *  );
378
379 strtok - string manipulation - #include <string.h> - all ports
380         char *strtok (char *, char *);
381
382 memcpy - string manipulation - #include <string.h> - all ports
383         void *memcpy (void *, void *, int );
384
385 memcmp - string manipulation - #include <string.h> - all ports
386         int   memcmp (void *, void *, int );
387
388 memset - string manipulation - #include <string.h> - all ports
389         void *memset (void *, unsigned char  , int );
390
391 time.h
392 /*-------------------------------------------------------------------------
393
394 mktime - time and date - #include <time.h> - all ports
395         time_t mktime(struct tm *timeptr);
396
397 asctime - time and date - #include <time.h> - all ports
398         char *asctime(struct tm *timeptr);
399
400 ctime - time and date - #include <time.h> - all ports
401         char *ctime(time_t *timep);
402