Skip to content
Snippets Groups Projects
Commit e30dec71 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

WIP: stdio.h

parent 2aff4d41
No related branches found
No related tags found
No related merge requests found
......@@ -199,6 +199,7 @@ dependencies = [
"compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins.git)",
"fcntl 0.1.0",
"platform 0.1.0",
"stdio 0.1.0",
"string 0.1.0",
"unistd 0.1.0",
]
......@@ -365,6 +366,14 @@ dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "stdio"
version = "0.1.0"
dependencies = [
"cbindgen 0.5.0",
"platform 0.1.0",
]
[[package]]
name = "string"
version = "0.1.0"
......
......@@ -14,6 +14,7 @@ members = ["crt0"]
compiler_builtins = { git = "https://github.com/rust-lang-nursery/compiler-builtins.git", default-features = false, features = ["mem"] }
platform = { path = "platform" }
fcntl = { path = "fcntl" }
stdio = { path = "stdio" }
string = { path = "string" }
unistd = { path = "unistd" }
......
#ifndef _BITS_STDIO_H
#define _BITS_STDIO_H
int printf(const char *restrict fmt, ...) {
int ret;
va_list ap;
va_start(ap, fmt);
ret = vfprintf(stdout, fmt, ap);
va_end(ap);
return ret;
}
#endif /* _BITS_STDIO_H */
#ifndef _STDARG_H
#define _STDARG_H
#define va_start(v,l) __builtin_va_start(v,l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
#define va_copy(d,s) __builtin_va_copy(d,s)
#endif /* _STDARG_H */
......@@ -5,6 +5,7 @@ extern crate compiler_builtins;
extern crate platform;
extern crate fcntl;
extern crate stdio;
extern crate string;
extern crate unistd;
......
[package]
name = "stdio"
version = "0.1.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
build = "build.rs"
[build-dependencies]
cbindgen = { path = "../cbindgen" }
[dependencies]
platform = { path = "../platform" }
extern crate cbindgen;
use std::{env, fs};
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
fs::create_dir_all("../target/include").expect("failed to create include directory");
cbindgen::generate(crate_dir)
.expect("failed to generate bindings")
.write_to_file("../target/include/stdio.h");
}
sys_includes = ["stdarg.h", "stddef.h"]
include_guard = "_stdio_H"
trailer = "#include <bits/stdio.h>"
language = "C"
[enum]
prefix_with_name = true
//! stdio implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/stdio.h.html
#![no_std]
extern crate platform;
use platform::types::*;
pub const BUFSIZ: c_int = 4096;
pub const FILENAME_MAX: c_int = 4096;
/*
#[no_mangle]
pub extern "C" fn func(args) -> c_int {
unimplemented!();
}
*/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment