Changeset 473 for trunk/libs/mini-libc
- Timestamp:
- Aug 21, 2018, 6:01:01 PM (6 years ago)
- Location:
- trunk/libs/mini-libc
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/mini-libc/dirent.c
r457 r473 26 26 #include <hal_user.h> 27 27 #include <syscalls_numbers.h> 28 #include <stdio.h> 28 29 29 30 ////////////////////////////////////// -
trunk/libs/mini-libc/mman.c
r457 r473 26 26 #include <hal_user.h> 27 27 #include <syscalls_numbers.h> 28 #include <stdio.h> 28 29 29 30 ////////////////////////////////y -
trunk/libs/mini-libc/stdio.c
r459 r473 38 38 //////////////////////////////////////////////////////////////////////////////////////// 39 39 40 ////////////////////////////////////////// 41 static int xprintf( char * string,42 unsigned int length,43 const char * format,44 va_list * args )40 /////////////////////////////////////////////////// 41 static unsigned int xprintf( char * string, 42 unsigned int length, 43 const char * format, 44 va_list * args ) 45 45 { 46 46 unsigned int ps = 0; // write index to the string buffer … … 265 265 int printf( const char * format, ... ) 266 266 { 267 char string[4096];268 va_list args;269 int count;267 char string[4096]; 268 va_list args; 269 unsigned int count; 270 270 271 271 va_start( args, format ); … … 309 309 const char * format, ... ) 310 310 { 311 va_list args;312 int count;311 va_list args; 312 unsigned int count; 313 313 314 314 va_start( args, format ); … … 374 374 const char * format, ... ) 375 375 { 376 char string[4096];377 va_list args;378 int count;379 int fd;376 char string[4096]; 377 va_list args; 378 unsigned int count; 379 int fd; 380 380 381 381 // check stream valid -
trunk/libs/mini-libc/stdio.h
r459 r473 31 31 ********************************************************************************************/ 32 32 33 /*********************************************************************************************34 * This defines the user level FILE structure.35 ********************************************************************************************/36 37 33 #define MAX_OPEN_FILE_PER_PROCESS 256 38 34 #define VALID_OPEN_FILE 0x12345678 39 35 #define EOF -1 40 36 #define NULL (void *)0 37 38 /********************************************************************************************* 39 * This defines the user level FILE structure. 40 ********************************************************************************************/ 41 41 42 42 typedef struct file_s -
trunk/libs/mini-libc/stdlib.c
r457 r473 28 28 #include <almosmkh.h> 29 29 #include <stdio.h> 30 31 ////////////////////////////////////////////////////////////////////////////////////////// 32 // Global variables 33 ////////////////////////////////////////////////////////////////////////////////////////// 34 35 unsigned int rand_seed_value = 1; // set by srand() , used by rand() 30 36 31 37 ////////////////////////// … … 121 127 get_cycle( &cycle ); 122 128 123 unsigned int x = (unsigned int)cycle ;124 125 if ((x & 0xF ) > 7)126 { 127 return (x*x & 0xFFFF);129 unsigned int x = (unsigned int)cycle * rand_seed_value; 130 131 if ((x & 0xFF) > 0x7F) 132 { 133 return (x*x & RAND_MAX); 128 134 } 129 135 else 130 136 { 131 return (x*x*x & 0xFFFF);137 return (x*x*x & RAND_MAX); 132 138 } 133 139 } … … 136 142 void srand( unsigned int seed ) 137 143 { 138 printf("\n[ERROR] in %s : not implemented yet : do nothing\n", __FUNCTION__ );144 rand_seed_value = seed; 139 145 } 140 146 -
trunk/libs/mini-libc/stdlib.h
r445 r473 33 33 34 34 #include <shared_stdlib.h> 35 36 #define RAND_MAX 0xFFFF 35 37 36 38 /***************************************************************************************** -
trunk/libs/mini-libc/string.c
r445 r473 22 22 */ 23 23 24 #define NULL (void *)025 26 24 #include <string.h> 25 #include <stdio.h> 27 26 28 27 /////////////////////////////////////// -
trunk/libs/mini-libc/unistd.c
r457 r473 78 78 int pipe( int fd[2] ) 79 79 { 80 return -1;81 //return hal_user_syscall( SYS_PIPE,(reg_t)fd, 0, 0, 0 );80 return hal_user_syscall( SYS_PIPE, 81 (reg_t)fd, 0, 0, 0 ); 82 82 } 83 83
Note: See TracChangeset
for help on using the changeset viewer.