HPGCC3 Documentation 3.0 R003
|
00001 //& *** (c) 2006-2011 The HPGCC3 Team *** 00002 //& Claudio Lapilli 00003 //& Ingo Blank 00004 //& 00005 //& This file is licensed under the terms and conditions of the 00006 //& HPGCC3 license that is included with the source distribution. 00007 //& *** (c) 2006-2011 The HPGCC3 Team *** 00008 00009 // $Id: string.h 514 2007-11-18 03:11:26Z ingo $ 00010 00011 00016 #ifndef _HPSTRING_H 00017 #define _HPSTRING_H 00018 00019 // LONG TYPE DEFINITION, ADDED BY CLAUDIO 01/14/05 00020 #ifndef _LONGLONG_DEF 00021 typedef unsigned long long ULONGLONG; 00022 typedef long long LONGLONG; 00023 #define _LONGLONG_DEF 00024 #endif 00025 00026 00027 #include <ctype.h> 00028 #include <kos.h> 00029 00030 00032 int strlen(const char *s); 00033 00035 char *strcpy(char *dest, const char *src); 00036 00038 char *strncpy(char *dest, const char *src, size_t n); 00039 00041 char *strcat(char *dest, const char *src); 00042 00044 int strcmp(register const char *s1, register const char *s2); 00045 00047 int strncmp ( const char *s1, const char *s2, int num); 00048 00050 //char *itoa(int z, char * buff, int base); 00051 #define itoa(z,buff,base) lltoa((long long)z,buff,base) 00052 00053 00055 //char *utoa(unsigned z, char * buff, int base); 00056 #define utoa(z,buff,base) ulltoa((unsigned long long)z,buff,base) 00057 00059 char *lltoa(LONGLONG, char *,int base); 00060 00062 char *ulltoa(ULONGLONG, char *, int base); 00063 00070 char *upper(char *t, const char *s); 00071 #define strupr(str) upper(str,str) 00072 00089 char *strset(char *s, int fill); 00090 00091 char *str_unquote(char *s, char c); 00092 char *strdup(const char *s); 00093 00094 char *lower(char *t, const char *s); 00095 00096 #ifndef DOXYGEN_SKIP 00097 00098 00099 char *__dtoa(double x, char *buf, char exp_sym); 00100 00101 char *xpad(char *t, char *s, int n, int left, char c); 00102 00103 // REMOVED BY CLAUDIO - MAR 2006 00104 //int atoi_base(char *, int base); 00105 //unsigned atoui_base(char *, int base); 00106 LONGLONG atoll_base(const char *, int base); 00107 //ULONGLONG atoull_base(char *, int base); 00108 00109 #define atoi(str) ((int)atoll_base(str,10)) 00110 #define atoi_base(str,base) ((int)atoll_base(str,base)) 00111 #define atoui(str) ((unsigned int)atoull_base(str,10)) 00112 #define atoui_base(str,base) ((unsigned int)atoull_base(str,base)) 00113 00114 #define atoll(str) atoll_base(str,10) 00115 #define atoll_base(str,base) atoll_base(str,base) 00116 #define atoull(str) ((unsigned long long)atoll_base(str,10)) 00117 #define atoull_base(str,base) ((unsigned long long)atoll_base(str,base)) 00118 00119 00120 00121 #endif 00122 00123 // REMOVED BY CLAUDIO - MAR 2006 00124 /* 00125 int atoi(char *); 00126 unsigned atoui(char *); 00127 LONGLONG atoll(char *); 00128 ULONGLONG atoull(char *); 00129 */ 00130 00131 // ADDED BY CLAUDIO - MAR 2006 00132 // LOW-LEVEL UNSIGNED TO STRING CONVERSION LOOP 00133 char *_str2ull(const char *number,unsigned long long *result,int base); 00134 00135 00136 00137 00138 /* -*- OBSOLETE -*- 00139 // < ibl ; 2006-04-05 > 00140 00141 char * 00142 ints(int z, int base); 00143 00144 char * 00145 uints(unsigned z, int base); 00146 */ 00147 00148 00149 double atof(const char *); 00150 00151 void* memcpy(void *out, const void *in, int n); 00152 void memcpyw(void *dest,const void *source,int nwords); 00153 void * memset (char * dest, int C, int LENGTH); 00154 void memsetw(void *dest,int value, int nwords); 00155 void *memmove(void *_dest, const void *_source, size_t nbytes); 00156 //Additional string functions 00157 //Added by Al Borowski, 19th Nov, 2004 00158 //TODO: Add proper documentation? 00159 00160 char * strchr(const char *s, int c); 00161 char * strncat(char *s1, const char * s2, size_t n); 00162 char *strrchr(const char *s, int c); 00163 size_t strcspn(const char *s1, const char *s2); 00164 char *strpbrk(const char *s1, const char *s2); 00165 char *strtok(char *s1, const char *s2); 00166 char *strstr(const char *s1, const char *s2); 00167 size_t strspn(const char *s1, const char *s2); 00168 00169 00170 #endif