Commit Graph

62 Commits

Author SHA1 Message Date
Tom Almeida d7a0f3d526 Ensure gets stops on newline or bufchar 2018-07-03 12:36:41 +08:00
Tom Almeida bf6db91993 Actually remove stdlib from stdio. This should have been done with wchar being put in, but I messed something up 2018-07-03 12:24:51 +08:00
Tom Almeida 72177be0fa Add a working implementation of gets 2018-07-03 12:14:30 +08:00
Tom Almeida 7277286efd Implement Drop for FILE, so we flush when the process exits 2018-07-03 10:05:12 +08:00
Tom Almeida 81107f8cd1 Don't reset read/write every time we check if we can read or write 2018-07-03 10:01:48 +08:00
Tom Almeida e9cecfead3 Return -1 for error in printf 2018-07-03 09:48:21 +08:00
Tom Almeida 0d61f9f4fd Make sure we can actually write before writing anything when using printf 2018-07-03 09:13:48 +08:00
Tom Almeida da664d4919 Merged relibc with branch 2018-07-03 08:39:04 +08:00
Stephan Vedder cc210361d6 wchar support 2018-07-01 20:59:37 +02:00
Tom Almeida 05b4b76426 Fix some issues 2018-06-30 17:49:34 +08:00
Tom Almeida 10a9081b66 Made sure that something that's unsafe is actually marked as unsafe 2018-06-30 17:47:30 +08:00
Tom Almeida 18418254b9 Made sure lazy_static works with no_std 2018-06-30 17:37:26 +08:00
Tom Almeida 8075447fad 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-30 17:37:26 +08:00
Tom Almeida 57f7de1e6d 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-30 17:33:02 +08:00
Tom Almeida 4c65f14f9a Fixed some issues with temporary files and moved some raw pointers to Option<&T>s 2018-06-30 17:26:39 +08:00
Tom Almeida 71fa4026f5 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-30 17:26:35 +08:00
Tom Almeida a2dc22123f Merge branch 'master' into 'master'
# Conflicts:
#   src/stdio/src/default.rs
2018-06-30 09:19:54 +00:00
Tom Almeida 7e731e0b01 Made sure lazy_static works with no_std 2018-06-23 13:08:28 +08:00
Tom Almeida c7bdd31a18 Merged relibc (#311db758) with branch 2018-06-23 05:13:02 +08:00
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
jD91mZM2 12ce441f5c Use static mut over UnsafeCell 2018-06-22 22:40:30 +02: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
Tom Almeida 50bfebfe3e Fixed some issues with temporary files and moved some raw pointers to Option<&T>s 2018-06-23 03:44:33 +08:00
Tom Almeida 90c6937f17 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 03:44:30 +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