Lines Matching full:text
33 static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
35 const char *textstart = text;
39 if ( *text == '-' ) {
41 ++text;
43 if ( radix == 16 && SDL_strncmp(text, "0x", 2) == 0 ) {
44 text += 2;
48 if ( SDL_isdigit((unsigned char) *text) ) {
49 v = *text - '0';
50 } else if ( radix == 16 && SDL_isupperhex(*text) ) {
51 v = 10 + (*text - 'A');
52 } else if ( radix == 16 && SDL_islowerhex(*text) ) {
53 v = 10 + (*text - 'a');
59 ++text;
68 return (text - textstart);
73 static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
75 const char *textstart = text;
78 if ( radix == 16 && SDL_strncmp(text, "0x", 2) == 0 ) {
79 text += 2;
83 if ( SDL_isdigit((unsigned char) *text) ) {
84 v = *text - '0';
85 } else if ( radix == 16 && SDL_isupperhex(*text) ) {
86 v = 10 + (*text - 'A');
87 } else if ( radix == 16 && SDL_islowerhex(*text) ) {
88 v = 10 + (*text - 'a');
94 ++text;
99 return (text - textstart);
104 static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
106 const char *textstart = text;
109 if ( radix == 16 && SDL_strncmp(text, "0x", 2) == 0 ) {
110 text += 2;
114 if ( SDL_isdigit((unsigned char) *text) ) {
115 v = *text - '0';
116 } else if ( radix == 16 && SDL_isupperhex(*text) ) {
117 v = 10 + (*text - 'A');
118 } else if ( radix == 16 && SDL_islowerhex(*text) ) {
119 v = 10 + (*text - 'a');
125 ++text;
130 return (text - textstart);
136 static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
138 const char *textstart = text;
142 if ( *text == '-' ) {
144 ++text;
146 if ( radix == 16 && SDL_strncmp(text, "0x", 2) == 0 ) {
147 text += 2;
151 if ( SDL_isdigit((unsigned char) *text) ) {
152 v = *text - '0';
153 } else if ( radix == 16 && SDL_isupperhex(*text) ) {
154 v = 10 + (*text - 'A');
155 } else if ( radix == 16 && SDL_islowerhex(*text) ) {
156 v = 10 + (*text - 'a');
162 ++text;
171 return (text - textstart);
176 static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
178 const char *textstart = text;
181 if ( radix == 16 && SDL_strncmp(text, "0x", 2) == 0 ) {
182 text += 2;
186 if ( SDL_isdigit((unsigned char) *text) ) {
187 v = *text - '0';
188 } else if ( radix == 16 && SDL_isupperhex(*text) ) {
189 v = 10 + (*text - 'A');
190 } else if ( radix == 16 && SDL_islowerhex(*text) ) {
191 v = 10 + (*text - 'a');
197 ++text;
202 return (text - textstart);
208 static size_t SDL_ScanFloat(const char *text, double *valuep)
210 const char *textstart = text;
215 if ( *text == '-' ) {
217 ++text;
219 text += SDL_ScanUnsignedLong(text, 10, &lvalue);
221 if ( *text == '.' ) {
223 ++text;
224 while ( SDL_isdigit((unsigned char) *text) ) {
225 lvalue = *text - '0';
228 ++text;
238 return (text - textstart);
732 int SDL_sscanf(const char *text, const char *fmt, ...)
740 while ( SDL_isspace((unsigned char) *text) ) {
741 ++text;
760 if ( *text == '%' ) {
761 ++text;
779 ++text;
784 *valuep++ = *text++;
791 while ( SDL_isspace((unsigned char) *text) ) {
792 ++text;
820 if ( text[index] == '-' ) {
823 if ( text[index] == '0' ) {
824 if ( SDL_tolower((unsigned char) text[index+1]) == 'x' ) {
836 text += SDL_ScanLongLong(text, radix, &value);
847 text += SDL_ScanLong(text, radix, &value);
889 text += SDL_ScanUnsignedLongLong(text, radix, &value);
900 text += SDL_ScanUnsignedLong(text, radix, &value);
930 text += SDL_ScanUintPtrT(text, 16, &value);
942 text += SDL_ScanFloat(text, &value);
953 while ( !SDL_isspace((unsigned char) *text) ) {
954 ++text;
963 while ( !SDL_isspace((unsigned char) *text) ) {
964 *valuep++ = *text++;
984 if ( *text == *fmt ) {
985 ++text;
989 /* Text didn't match format specifier */
999 int SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...)
1005 retval = SDL_vsnprintf(text, maxlen, fmt, ap);
1013 static size_t SDL_PrintLong(char *text, long value, int radix, size_t maxlen)
1023 SDL_strlcpy(text, num, size+1);
1027 static size_t SDL_PrintUnsignedLong(char *text, unsigned long value, int radix, size_t maxlen)
1037 SDL_strlcpy(text, num, size+1);
1042 static size_t SDL_PrintLongLong(char *text, Sint64 value, int radix, size_t maxlen)
1052 SDL_strlcpy(text, num, size+1);
1056 static size_t SDL_PrintUnsignedLongLong(char *text, Uint64 value, int radix, size_t maxlen)
1066 SDL_strlcpy(text, num, size+1);
1071 static size_t SDL_PrintFloat(char *text, double arg, size_t maxlen)
1073 char *textstart = text;
1081 *text++ = '-';
1086 len = SDL_PrintUnsignedLong(text, value, 10, maxlen);
1087 text += len;
1092 *text++ = '.';
1095 len = SDL_PrintUnsignedLong(text, value, 10, maxlen);
1096 text += len;
1103 *text++ = '0';
1105 return (text - textstart);
1107 static size_t SDL_PrintString(char *text, const char *string, size_t maxlen)
1109 char *textstart = text;
1111 *text++ = *string++;
1113 return (text - textstart);
1115 int SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap)
1117 char *textstart = text;
1142 *text = '%';
1148 *text = (char)va_arg(ap, int);
1170 len = SDL_PrintLong(text, (long)va_arg(ap, int), radix, maxlen);
1173 len = SDL_PrintLong(text, va_arg(ap, long), radix, maxlen);
1177 len = SDL_PrintLongLong(text, va_arg(ap, Sint64), radix, maxlen);
1179 len = SDL_PrintLong(text, va_arg(ap, long), radix, maxlen);
1205 len = SDL_PrintUnsignedLong(text, (unsigned long)va_arg(ap, unsigned int), radix, maxlen);
1208 len = SDL_PrintUnsignedLong(text
1212 len = SDL_PrintUnsignedLongLong(text, va_arg(ap, Uint64), radix, maxlen);
1214 len = SDL_PrintUnsignedLong(text, va_arg(ap, unsigned long), radix, maxlen);
1219 SDL_strlwr(text);
1224 len = SDL_PrintFloat(text, va_arg(ap, double), maxlen);
1228 len = SDL_PrintString(text, va_arg(ap, char*), maxlen);
1237 text += len;
1240 *text++ = *fmt++;
1244 *text = '\0';
1246 return (text - textstart);