Changeset 684
- Timestamp:
- Jan 13, 2021, 12:40:22 AM (4 years ago)
- Location:
- trunk/libs/mini-libc
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/mini-libc/stdio.c
r677 r684 142 142 } 143 143 case ('x'): // up to 8 digits hexa after "0x" 144 case ('X'): // exactly 8 digits hexa after "0x"145 144 { 146 145 unsigned int val = va_arg( *args , unsigned int ); … … 150 149 { 151 150 buf[7 - i] = HexaTab[val & 0xF]; 152 if( (*format == 'x') && ((val >> 4) == 0) ) break;153 151 val = val >> 4; 152 if( val == 0) break; 154 153 } 155 154 len = i + 1; … … 157 156 break; 158 157 } 158 case ('X'): // exactly 8 digits hexa after "0x" 159 { 160 unsigned int val = va_arg( *args , unsigned int ); 161 TO_STREAM( '0' ); 162 TO_STREAM( 'x' ); 163 for(i = 0 ; i < 8 ; i++) 164 { 165 buf[7 - i] = (val != 0) ? HexaTab[val & 0xF] : '0'; 166 val = val >> 4; 167 } 168 len = 8; 169 pbuf = &buf[0]; 170 break; 171 } 159 172 case ('l'): // up to 16 digits hexa after "0x" 160 case ('L'): // exactly 16 digits hexa after "0x"161 173 { 162 174 unsigned long long val = ((unsigned long long)va_arg( *args, unsigned int)) | … … 167 179 { 168 180 buf[15 - i] = HexaTab[val & 0xF]; 169 if( (*format == 'l') && ((val >> 4) == 0) ) break;170 181 val = val >> 4; 182 if( val == 0) break; 171 183 } 172 184 len = i + 1; 173 185 pbuf = &buf[15 - i]; 186 break; 187 } 188 case ('L'): // exactly 16 digits hexa after "0x" 189 { 190 unsigned long long val = ((unsigned long long)va_arg( *args, unsigned int)) | 191 ((unsigned long long)va_arg( *args, unsigned int) << 32); 192 TO_STREAM( '0' ); 193 TO_STREAM( 'x' ); 194 for(i = 0 ; i < 16 ; i++) 195 { 196 buf[15 - i] = (val != 0) ? HexaTab[val & 0xF] : '0'; 197 val = val >> 4; 198 } 199 len = 16; 200 pbuf = &buf[0]; 174 201 break; 175 202 } -
trunk/libs/mini-libc/stdlib.c
r650 r684 48 48 while( str[i] != 0 ) 49 49 { 50 if ( (str[i] >= '0') && (str[i] <= '9') ) res = (res<<4) + (str[i] - '0');51 else if( (str[i] >= 'A') && (str[i] <= 'F') ) res = (res<<4) + (str[i] - 'A');52 else if( (str[i] >= 'a') && (str[i] <= 'f') ) res = (res<<4) + (str[i] - 'a');50 if ( (str[i] >= '0') && (str[i] <= '9') ) res = (res<<4) + (str[i] - '0'); 51 else if( (str[i] >= 'A') && (str[i] <= 'F') ) res = (res<<4) + 10 + (str[i] - 'A'); 52 else if( (str[i] >= 'a') && (str[i] <= 'f') ) res = (res<<4) + 10 + (str[i] - 'a'); 53 53 else return 0; 54 54 i++; -
trunk/libs/mini-libc/unistd.h
r677 r684 75 75 * The old process descriptor, and all its threads are blocked, and marked for deletion. 76 76 * Therefore the exec syscall does not return to the calling thread in case of success. 77 * This function build an exec_info_t structure containing the new process arguments,78 * a s defined by the <arv> argument, and the new process environment variables,79 * as defined by the <envp> argument.77 * This function initializes the exec_info_t structure (embedded in process descriptor), 78 * and containing the <filename>, <args> and <envs> arguments. 79 * 80 80 * TODO : the <envs> argument is not supported yet (must be NULL). 81 81 ***************************************************************************************** 82 82 * @ filename : string pointer on .elf filename (virtual pointer in user space) 83 * @ args : array of pointers on process arguments (strings in user space)84 * @ envs : array of pointers on environment variables (strings in user space)83 * @ args : NULL terminated array of strings pointers on process arguments. 84 * @ envs : NULL terminated array of strings pointers on environment variables. 85 85 * @ does not return if success / returns -1 if failure. 86 86 ****************************************************************************************/ … … 201 201 202 202 /***************************************************************************************** 203 * This function implements the <sleep> system call. 204 * It suspends execution of the calling thread until either <seconds> have elapsed, 205 * or a signal is delivered to the thread and its action is to terminate the thread. 206 * System activity may lengthen the sleep by an indeterminate amount. 207 ***************************************************************************************** 208 * @ seconds : sleep duration in seconds. 209 * @ return 0 if success / returns number of unslept seconds if signal delivery. 210 ****************************************************************************************/ 211 unsigned int sleep( unsigned int seconds ); 212 213 /***************************************************************************************** 203 214 * This function implements the <sync> system call. 204 215 * It forces all kernel mappers (file caches) to be copied to the IOC device.
Note: See TracChangeset
for help on using the changeset viewer.