Some of the implementation choices

From SDCC wiki
Jump to: navigation, search
Not finished - 20 Jan 2002 - checkpoint (Steve Kenton)

This is a sorted (ignoring leading '_') list of the SDCC library.
Sources are in ~sdcc/device/lib/*.c and ~sdcc/device/include/*.h.
Except where denoted with MACRO these are implemented as functions.
Internal function calls are generated by the compiler to implement
IEEE floating point, etc.  They are not normally called directly.

isalnum - character classification - #include <ctype.h> - all ports
        char isalnum (unsigned char c); MACRO
        Return true if c is an ASCII letter or digit
        'a-z','A-Z', '0'-'9' otherwise return false.

isalpha - character classification - #include <ctype.h> - all ports
        char isalpha (unsigned char c); MACRO
        Return true if c is an ASCII letter
        'a-z','A-Z' otherwise return false.

isascii - character classification - #include <ctype.h> - missing
        char isascii (unsigned char c);
        Return true if c is an 7-bit ASCII character
        0x00-0x7F otherwise return false.

iscntrl - character classification - #include <ctype.h> - all ports
        char iscntrl (unsigned char c);
        Return true if c is an ASCII control character
        0x00-0x1F or 0x7F (DEL) otherwise return false.

isdigit - character classification - #include <ctype.h> - all ports
        char isdigit (unsigned char c);
        Return true if c is an ASCII digit '0'-'9'
        otherwise return false.

isgraph - character classification - #include <ctype.h> - all ports
        char isgraph (unsigned char c);
        Return true is c is an ASCII printable graphic
        excluding space 0x21-0x7E otherwise return false.

islower - character classification - #include <ctype.h> - all ports
        char islower (unsigned char c);
        Return true if c is an ASCII lower case letter
        'a'-'z' otherwise return false.

isprint - character classification - #include <ctype.h> - all ports
        char isprint (unsigned char c);
        Return true is c is an ASCII printable graphic
        including space 0x20-0x7E otherwise return false.

ispunct - character classification - #include <ctype.h> - all ports
        char ispunct (unsigned char c);
        Return true if c is ASCII punctuation (isgraph but not isalnum)
        otherwise return false.

isspace - character classification - #include <ctype.h> - all ports
        char isspace (unsigned char c);
        Return true if c is an ASCII white space character
        space, tab, carriage return, newline or vertical tab
        0x09-0x0D, 0x20 otherwise return false.

isupper - character classification - #include <ctype.h> - all ports
        char isupper (unsigned char c);
        Return true if c is an ASCII upper case letter
        'A'-'Z' otherwise return false.

isxdigit - character classification - #include <ctype.h> - all ports
        char isxdigit (unsigned char c);
        Return true if c is an ASCII hexidecimal digit
        '0-9','a-f','A-F' otherwise return false.

toascii - character classification - #include <ctype.h> - all ports
        char toascii(unsigned char c); MACRO
        Convert c from 8-bit value to 7-bit ASCII.

tolower - character classification - #include <ctype.h> - all ports
        char _tolower(unsigned char c); MACRO
        char tolower(unsigned char c); MACRO
        Convert c from upper case to lower case.

toupper - character classification - #include <ctype.h> - all ports
        char _toupper(unsigned char c); MACRO
        char toupper(unsigned char c); MACRO
        Convert c from lower case to upper case.

__uchar2fs - IEEE single precision math - #include <float.h> - ??? ports
        float __uchar2fs (unsigned char uc); INTERNAL
        Convert an unsigned char to float.

__schar2fs - IEEE single precision math - #include <float.h> - ??? ports
        float __schar2fs (signed char sc); INTERNAL
        Convert a signed char to float.

__uint2fs - IEEE single precision math - #include <float.h> - ??? ports
        float __uint2fs (unsigned int ui); INTERNAL
        Convert an unsigned int to float.

__sint2fs - IEEE single precision math - #include <float.h> - ??? ports
        float __sint2fs (signed int si); INTERNAL
        Convert a signed int to float.

__ulong2fs - IEEE single precision math - #include <float.h> - ??? ports
        float __ulong2fs (unsigned long ul); INTERNAL
        Convert an unsigned log to float.

__slong2fs - IEEE single precision math - #include <float.h> - ??? ports
        float __slong2fs (signed long sl); INTERNAL
        Convert a signed long to float.

__fs2uchar - IEEE single precision math - #include <float.h> - ??? ports
        unsigned char __fs2uchar (float f); INTERNAL
        Convert a float to unsigned char;

__fs2schar - IEEE single precision math - #include <float.h> - ??? ports
        signed char __fs2schar (float f); INTERNAL
        Convert a float to signed char;

__fs2uint - IEEE single precision math - #include <float.h> - ??? ports
        unsigned int __fs2uint (float f); INTERNAL
        Convert a float to unsigned int;

__fs2sint - IEEE single precision math - #include <float.h> - ??? ports
        signed int __fs2sint (float f); INTERNAL
        Convert a float to signed int;

__fs2ulong - IEEE single precision math - #include <float.h> - ??? ports
        unsigned long __fs2ulong (float f); INTERNAL
        Convert a float to unsigned long;

__fs2slong - IEEE single precision math - #include <float.h> - ??? ports
        signed long __fs2slong (float f); INTERNAL
        Convert a float to signed long.

__fsadd - IEEE single precision math - #include <float.h> - ??? ports
        float __fsadd (float a1, float a2); INTERNAL
        Add two floats.

__fssub - IEEE single precision math - #include <float.h> - ??? ports
        float __fssub (float a1, float a2); INTERNAL
        Subtract two floats.

__fsmul - IEEE single precision math - #include <float.h> - ??? ports
        float __fsmul (float a1, float a2); INTERNAL
        Multiply two floats.

__fsdiv - IEEE single precision math - #include <float.h> - ??? ports
        float __fsdiv (float a1, float a2); INTERNAL
        Divide two floats.

__fslt - IEEE single precision math - #include <float.h> - ??? ports
        char __fslt (float a1, float a2); INTERNAL
        Compare two floats lt.

__fseq - IEEE single precision math - #include <float.h> - ??? ports
        char __fseq (float a1, float a2); INTERNAL
        Compare two floats eq.

__fsneq - IEEE single precision math - #include <float.h> - ??? ports
        char __fseq (float a1, float a2); INTERNAL ??? missing in float.h ???
        Compare two floats neq.

__fsgt - IEEE single precision math - #include <float.h> - ??? ports
        char __fsgt (float a1, float a2); INTERNAL ??? typo in float.h ???
        Compare two floats gt.

malloc - memory allocation - #include <malloc.h> - ??? ports
        void *malloc (unsigned int);
        void xdata * malloc (unsigned int );
        Allocate a block of memory from the heap;

free - memory allocation - #include <malloc.h> - ??? ports
        void free (void *p);
        void free (void xdata *  p);
        Return previously allocated memory to the heap.

init_dynamic_memory - memory allocation - #include <malloc.h> - ??? ports
        void init_dynamic_memory (MEMHEADER xdata *  , unsigned int );
        Initialize the memory allocation system.

sincosf - ANSI C math - #include <math.h> - all ports
        float sincosf(const float x, const int iscos); INTERNAL
        Compute the sine or cosine of x.

tancotf - ANSI C math - #include <math.h> - all ports
        float tancotf(const float x, const int iscot); INTERNAL
        Compute the tangent or cotangent of x.

asincosf - ANSI C math - #include <math.h> - all ports
        float asincosf(const float x, const int isacos); INTERNAL
        Compute the arc sine or arc cosine of x.

sincoshf - ANSI C math - #include <math.h> - all ports
        float sincoshf(const float x, const int iscosh); INTERNAL
        Compute the hyperbolic sine or hyperbolic cosine of x.

sinf - ANSI C math - #include <math.h> - all ports
        float sinf (const float x);
        Compute sine of x.

cosf - ANSI C math - #include <math.h> - all ports
        float cosf (const float x);
        Compute cosine of x.

tanf - ANSI C math - #include <math.h> - all ports
        float tanf (const float x);
        Compute tangent of x.

cotf - ANSI C math - #include <math.h> - all ports
        float cotf (const float x);
        Compute cotangent of x.

asinf - ANSI C math - #include <math.h> - all ports
        float asinf (const float x);
        Compute the arc sine of x.

acosf - ANSI C math - #include <math.h> - all ports
        float acosf (const float x);
        Compute the arc cosine of x.

atanf - ANSI C math - #include <math.h> - all ports
        float atanf (const float x);
        Compute the arc tangent of x.

atan2f - ANSI C math - #include <math.h> - all ports
        float atan2f (const float x, const float y); ??? x,y reversed ???
        Compute the arc tangent of (x/y);

sinhf - ANSI C math - #include <math.h> - all ports
        float sinhf (const float x);
        Compute the hyperbolic sine of x.

coshf - ANSI C math - #include <math.h> - all ports
        float coshf (const float x);
        Compute the hyperbolic cosine of x.

tanhf - ANSI C math - #include <math.h> - all ports
        float tanhf (const float x);
        Compute the hyperbolic tangent of x.

expf - ANSI C math - #include <math.h> - all ports
        float expf (const float x);
        Compute e to the x power.

logf - ANSI C math - #include <math.h> - all ports
        float logf (const float x);
        Compute log base e of x.

log10f - ANSI C math - #include <math.h> - all ports
        float log10f (const float x);
        Compute log base 10 of x.

powf - ANSI C math - #include <math.h> - all ports
        float powf (const float x, const float y);
        Compute x to y power.

sqrtf - ANSI C math - #include <math.h> - all ports
        float sqrtf (const float x);
        Compute the square root of x.

fabsf - ANSI C math - #include <math.h> - all ports
        float fabsf (const float x);
        Compute the absolute value of x.

frexpf - ANSI C math - #include <math.h> - all ports
        float frexpf (const float x, int *pw2);
        Split x in to mantissa and exponent parts.

ldexpf - ANSI C math - #include <math.h> - all ports
        float ldexpf (const float x, const int pw2);
        Combine mantissa and exponent parts of a float.

ceilf - ANSI C math - #include <math.h> - all ports
        float ceilf (float x);
        Find the smallest integer not less than x.

floorf - ANSI C math - #include <math.h> - all ports
        float floorf (float x);
        Find the largest integer not more than x.

modff - ANSI C math - #include <math.h> - all ports
        float modff (float x, float * y);
        Split x in to integer and fractional parts.

setjmp - long jump - #include <setjmp.h> - ??? ports
        int setjmp (unsigned char * jmpb);
        Save the return address and sufficient task state
        to allow implementation of co-routines or error
        handlers that unwind the stack using longjmp.
        Returns 0, which is reserved and cannot be used
        by longjmp.

longjmp - long jump - #include <setjmp.h> - ??? ports
        int longjmp (unsigned char * jmpb, int retval);
        Return to the the location and task state previously
        save in the jump buffer.  Any integer number except 0
        may be passed as retval.

stdio.h
/*-------------------------------------------------------------------------
printf_small - standard character I/O - #include <stdio.h> - all ports
        void printf_small (char *,...);

printf - standard character I/O - #include <stdio.h> - all ports
        int printf (const char *,...);

vprintf - standard character I/O - #include <stdio.h> - all ports
        int vprintf (const char *, va_list);

sprintf - standard character I/O - #include <stdio.h> - all ports
        int sprintf (const char *, const char *, ...);

vsprintf - standard character I/O - #include <stdio.h> - all ports
        int vsprintf (const char *, const char *, va_list);

puts - standard character I/O - #include <stdio.h> - all ports
        int puts(const char *);

gets - standard character I/O - #include <stdio.h> - all ports
        char *gets(char *);

getchar - standard character I/O - #include <stdio.h> - all ports
        char getchar(void);

putchar - standard character I/O - #include <stdio.h> - all ports
        void putchar(char);

string.h
/*-------------------------------------------------------------------------
strcpy - string manipulation - #include <string.h> - all ports
        char *strcpy (char * d, char * s);
        Copy the nul terminated source string s to the destination d.

strncpy - string manipulation - #include <string.h> - all ports
        char *strncpy(char * d, char * s, int n);
        Copy the nul terminated source string s to the destination d but
        do not copy more than n characters even if this causes d to not
        be nul terminated.

strcat - string manipulation - #include <string.h> - all ports
        char *strcat (char * front, char * back);
        Copy the nul terminated string back to the end of the nul terminated
        string front, overwriting the nul and creating a concatenation of
        the two with a single trailing nul terminator.

strncat - string manipulation - #include <string.h> - all ports
        char *strncat(char * front, char * back, int n);
        Copy the nul terminated string back to the end of the nul terminated
        string front, overwriting the nul and creating a concatenation of
        the two, but do not copy more than n characters, even if this causes
        the result to no be nul terminated.

strcmp - string manipulation - #include <string.h> - all ports
        int   strcmp (char * asrc, char * adst);
        Compare two nul terminated strings asrc and adst.  Return a value < 0 if asrc
        is less than adst.  Return a value > 0 if asrc is greater than adst.  Otherwise
        return 0.

strncmp - string manipulation - #include <string.h> - all ports
        int   strncmp(char * asrc, char * adst, int n);
        Compare two nul terminated strings asrc and adst but do not check more than n
        characters.  Return a value < 0 if asrc is less than adst.  Return a value > 0
        if asrc is greater than adst. Otherwise return 0.

strchr - string manipulation - #include <string.h> - all ports
        char *strchr (char * string, char ch);
        Return a pointer to the first occurrence of the character ch is string
        or a NULL pointer if not found.

strrchr - string manipulation - #include <string.h> - all ports
        char *strrchr(char * string, char ch);
        Return a pointer to the last occurrence of the character ch is string
        or a NULL pointer if not found.

strspn - string manipulation - #include <string.h> - all ports
        int   strspn (char *, char *);

strcspn - string manipulation - #include <string.h> - all ports
        int   strcspn(char *, char *);

strpbrk - string manipulation - #include <string.h> - all ports
        char *strpbrk(char *, char *);

strstr - string manipulation - #include <string.h> - all ports
        char *strstr (char *, char *);

strlen - string manipulation - #include <string.h> - all ports
        int   strlen (char *  );

strtok - string manipulation - #include <string.h> - all ports
        char *strtok (char *, char *);

memcpy - string manipulation - #include <string.h> - all ports
        void *memcpy (void *, void *, int );

memcmp - string manipulation - #include <string.h> - all ports
        int   memcmp (void *, void *, int );

memset - string manipulation - #include <string.h> - all ports
        void *memset (void *, unsigned char  , int );

time.h
/*-------------------------------------------------------------------------

mktime - time and date - #include <time.h> - all ports
        time_t mktime(struct tm *timeptr);

asctime - time and date - #include <time.h> - all ports
        char *asctime(struct tm *timeptr);

ctime - time and date - #include <time.h> - all ports
        char *ctime(time_t *timep);
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox