Commit Graph

40 Commits

Author SHA1 Message Date
Tom Almeida 6bc28203ca Changed FILE to use a vector as a buffer instead of raw pointers. This allows us to remove the large majority of unsafe blocks from the code 2018-06-23 05:01:43 +08:00
Tom Almeida b5529c9b71 Fixed some issues with temporary files and moved some raw pointers to Option<&T>s 2018-06-23 04:28:03 +08:00
Tom Almeida 5921f00e90 Changed FILE to use a vector as a buffer instead of raw pointers. This allows us to remove the large majority of unsafe blocks from the code 2018-06-23 04:28:00 +08:00
jD91mZM2 ea24699798 Fix undefined behavior
Transmuting from an immutable to a mutable reference is undefined
behavior in Rust, with the exception of UnsafeCell which tells the
optimizer to not draw too many conclusions. Sadly UnsafeCell::get cannot
yet be used in statics (see https://github.com/rust-lang/rust/issues/51718),
so this works around that by making the statics into functions and
making C macros to call those.
2018-06-22 21:17:44 +02:00
jD91mZM2 996445a6a3 Add empty locale functions 2018-06-22 14:54:10 +02:00
jD91mZM2 5936c7a76e Add scanf 2018-06-21 17:16:56 +02:00
Jeremy Soller 1b653c4e60 Update ralloc, fix invalid c++ names 2018-06-20 08:48:56 -06:00
Alex Lyon aa21e5fc3f stdlib: implement qsort() as an introsort 2018-05-13 03:07:00 -07:00
Alex Lyon 0cabecd5b5 stdio, string, platform: fix a bug in printf() involving chars
Because we were previously converting the bytes in the format
string into Rust's char type and then printing that using the
format machinery, byte values that were not valid single-byte
UTF-8 characters failed to print correctly.  I found this while
trying to implement qsort() because the output of my test program
was mysteriously incorrect despite it working when I used glibc.
2018-05-11 23:09:12 -07:00
Jeremy Soller dabd8dc6a2 Move memory handling into string, do not use compiler_builtins for memory handling 2018-03-27 21:28:48 -06:00
Dan Robertson 57a17cb05f stdio: Implement rename 2018-03-25 14:41:42 +00:00
Tom Almeida dbc3e413cc Fixed clearerr actually doing nothing 2018-03-20 23:43:42 +08:00
Tom Almeida c24d1e2b36 Removed all function pointers in FILE, moved internal functions to be member functions of FILE, made relevant *mut FILEs into &mut FILE and made suitable functions safe again 2018-03-18 00:20:21 +08:00
Tom Almeida d7965f2598 Made it so that AtomicBool exports as volatile char 2018-03-18 00:19:08 +08:00
Tom Almeida 659d3d1042 Changed object type of function pointers from Option<*const (Fn(...))> to Option<fn(...)> for readability 2018-03-16 23:14:43 +08:00
Tom Almeida 81d96c214a Ran formatting for freopen() 2018-03-16 20:47:32 +08:00
Tom Almeida 8d40424020 Added freopen() and relevant tests 2018-03-16 20:24:40 +08:00
Tom Almeida 41b96fede3 Added a different internal function for redox 2018-03-15 15:57:19 +08:00
Tom Almeida c4c8b73903 Formatted stdio files 2018-03-15 15:34:39 +08:00
Tom Almeida 7f2b720962 Implemented stdio functions 2018-03-15 15:27:07 +08:00
Tom Almeida 046ce1468e Removed an unused import from printf 2018-03-15 15:23:38 +08:00
Tom Almeida 49be92f87f ran fmt.sh cause I'm an idiot 2018-03-11 00:39:43 +08:00
Tom Almeida 8374fcb4be implemented fputc, fputs, and puts 2018-03-11 00:33:00 +08:00
Alex Lyon a7e71717cb stdio: add support for %o to printf() 2018-03-09 02:51:50 -08:00
Jeremy Soller a95a034219 Fix issues by adding support for floating point values in va_list 2018-03-08 20:54:46 -07:00
Jeremy Soller 56e304a2af Fix format 2018-03-08 20:20:21 -07:00
Jeremy Soller 0e766c6b53 Implement atof 2018-03-08 20:17:45 -07:00
Jeremy Soller 284cc4eece Fix formatting 2018-03-08 16:21:04 -07:00
Jeremy Soller 18961114e2 Simplify perror 2018-03-08 14:51:22 -07:00
Paul Sajna 22fb6c5bf0 copy strerror implementation into perror 2018-03-08 11:20:13 -08:00
Paul Sajna 6304595a1d Merge branch 'master' of github.com:redox-os/relibc 2018-03-08 11:07:51 -08:00
Dan Robertson ec288a1b53 Add ctype functions and atoi/atol
Add ctype functions
  - isalnum
  - isalpha
  - isascii
  - isdigit
  - islower
  - isspace
  - isupper
Add stdlib functions
  - atoi
  - atol
Fix some warnings
Make a fmt run
2018-03-08 05:26:40 +00:00
Paul Sajna 3b7149612f implement perror 2018-03-07 20:57:51 -08:00
Jeremy Soller 1198ad3ae7 Format vsnprintf 2018-03-06 22:02:30 -07:00
Jeremy Soller ff0cebca87 Implement more stdio functions 2018-03-06 21:47:39 -07:00
Jeremy Soller 543526cb85 Move crt0 and platform into src folder
Add cargo fmt script
2018-03-06 19:55:11 -07:00
Dan Robertson 846e495944 Get rustfmt passing on core relibc code
- Add a rustfmt config
 - Get the current code passing the formatter
2018-03-07 01:52:50 +00:00
Paul Sajna 5cc52e4b19 tests 2018-03-04 16:34:46 -08:00
Jeremy Soller 866d952924 Support building for Redox 2018-03-04 08:10:42 -07:00
Jeremy Soller 083fd72e66 Reorganize 2018-03-03 20:24:40 -07:00