SimpleOS

LXR

Navigation



Site hébergé par : enix

The LXR Cross Referencer for SOS

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Article:1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 6.5 ] [ 7 ] [ 7.5 ] [ 8 ] [ 9 ] [ 9.5 ]

Diff markup

Differences between /sos/klibc.h (Article 4) and /sos/klibc.h (Article 3)


001 /* Copyright (C) 2003  The KOS Team               001 /* Copyright (C) 2003  The KOS Team
002    Copyright (C) 1999  Free Software Foundatio    002    Copyright (C) 1999  Free Software Foundation
003                                                   003 
004    This program is free software; you can redi    004    This program is free software; you can redistribute it and/or
005    modify it under the terms of the GNU Genera    005    modify it under the terms of the GNU General Public License
006    as published by the Free Software Foundatio    006    as published by the Free Software Foundation; either version 2
007    of the License, or (at your option) any lat    007    of the License, or (at your option) any later version.
008                                                   008    
009    This program is distributed in the hope tha    009    This program is distributed in the hope that it will be useful,
010    but WITHOUT ANY WARRANTY; without even the     010    but WITHOUT ANY WARRANTY; without even the implied warranty of
011    MERCHANTABILITY or FITNESS FOR A PARTICULAR    011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012    GNU General Public License for more details    012    GNU General Public License for more details.
013                                                   013    
014    You should have received a copy of the GNU     014    You should have received a copy of the GNU General Public License
015    along with this program; if not, write to t    015    along with this program; if not, write to the Free Software
016    Foundation, Inc., 59 Temple Place - Suite 3    016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
017    USA.                                           017    USA. 
018 */                                                018 */
019 #ifndef _SOS_KLIBC_H_                             019 #ifndef _SOS_KLIBC_H_
020 #define _SOS_KLIBC_H_                             020 #define _SOS_KLIBC_H_
021                                                   021 
022 /**                                               022 /**
023  * @file klibc.h                                  023  * @file klibc.h
024  *                                                024  *
025  * Basic libc-style support for common useful     025  * Basic libc-style support for common useful functions (string.h,
026  * stdarg.h), some with slight non-standard be    026  * stdarg.h), some with slight non-standard behavior (see comments).
027  */                                               027  */
028                                                   028 
029 #include <sos/types.h>                            029 #include <sos/types.h>
030                                                   030 
031 /* string.h functions */                          031 /* string.h functions */
032                                                   032 
033 void *memcpy(void *dst, const void *src, regis    033 void *memcpy(void *dst, const void *src, register unsigned int size ) ;
034 void *memset(void *dst, register int c, regist    034 void *memset(void *dst, register int c, register unsigned int length ) ;
035 int memcmp(const void *s1, const void *s2, sos    035 int memcmp(const void *s1, const void *s2, sos_size_t n);
036                                                   036 
037 unsigned int strlen( register const char *str)    037 unsigned int strlen( register const char *str) ;
038 unsigned int strnlen(const char * s, sos_size_    038 unsigned int strnlen(const char * s, sos_size_t maxlen);
039                                                   039 
040 /**                                               040 /**
041  * @note Same as strncpy(), with a slightly di    041  * @note Same as strncpy(), with a slightly different semantic.
042  * Actually, strncpy(3C) says " The result wil    042  * Actually, strncpy(3C) says " The result will not be null-terminated
043  * if the length of 'from' is n or more.".  He    043  * if the length of 'from' is n or more.".  Here, 'dst' is ALWAYS
044  * null-terminated. And its total len will ALW    044  * null-terminated. And its total len will ALWAYS be <= len, with
045  * null-terminating-char included.                045  * null-terminating-char included.
046  */                                               046  */
047 char *strzcpy( register char *dst, register co    047 char *strzcpy( register char *dst, register const char *src,
048                register int len ) ;               048                register int len ) ;
049                                                   049 
050 /**                                               050 /**
051  * @note Same as strncat(), with the same sema    051  * @note Same as strncat(), with the same semantic : 'dst' is ALWAYS
052  * null-terminated. And its total len will ALW    052  * null-terminated. And its total len will ALWAYS be <= len, with
053  * null-terminating-char included.                053  * null-terminating-char included.
054  */                                               054  */
055 char *strzcat (char *dest, const char *src,       055 char *strzcat (char *dest, const char *src,
056                const sos_size_t len);             056                const sos_size_t len);
057                                                   057  
058 int strcmp(register const char *s1, register c    058 int strcmp(register const char *s1, register const char *s2 );
059 int strncmp(register const char *s1, register     059 int strncmp(register const char *s1, register const char *s2,
060             register int len );                   060             register int len );
061                                                   061 
062 /* Basic stdarg.h macros. Taken from gcc suppo    062 /* Basic stdarg.h macros. Taken from gcc support files */
063 #define __GNUC_VA_LIST                            063 #define __GNUC_VA_LIST 
064 typedef void *__gnuc_va_list;                     064 typedef void *__gnuc_va_list;
065 typedef __gnuc_va_list va_list;                   065 typedef __gnuc_va_list va_list;
066 #define __va_rounded_size(TYPE) \                 066 #define __va_rounded_size(TYPE) \
067   (((sizeof (TYPE) + sizeof (int) - 1) / sizeo    067   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
068 #define va_start(AP, LASTARG) \                   068 #define va_start(AP, LASTARG) \
069   (AP = ((__gnuc_va_list) __builtin_next_arg (    069   (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
070 #define va_end(AP) \                              070 #define va_end(AP) \
071   ((void)0)                                       071   ((void)0)
072 #define va_arg(AP, TYPE) \                        072 #define va_arg(AP, TYPE) \
073   (AP = (__gnuc_va_list) ((char *) (AP) + __va    073   (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),  \
074    *((TYPE *) (void *) ((char *) (AP) - __va_r    074    *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
075 #define __va_copy(dest, src) \                    075 #define __va_copy(dest, src) \
076   (dest) = (src)                                  076   (dest) = (src)
077                                                   077 
078 /* stdarg.h functions. There might be a non-st    078 /* stdarg.h functions. There might be a non-standard behavior: there
079    will always be a trailing '\0' in the resul    079    will always be a trailing '\0' in the resulting string */
080 int vsnprintf(char *, sos_size_t, const char *    080 int vsnprintf(char *, sos_size_t, const char *, va_list);
081 int snprintf(char *, sos_size_t, const char *,    081 int snprintf(char *, sos_size_t, const char *, /*args*/ ...)
082   __attribute__ ((format (printf, 3, 4)));        082   __attribute__ ((format (printf, 3, 4)));
083                                                   083 
084 #endif /* _SOS_KLIBC_H_ */                        084 #endif /* _SOS_KLIBC_H_ */
                                                      

source navigation ] diff markup ] identifier search ] general search ]