1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os,gl,sync: cleanup, prepare for .toplevel_comments vdoc mode

This commit is contained in:
Delyan Angelov
2020-06-06 18:25:58 +03:00
parent 32463e94f5
commit 3aecdeab63
4 changed files with 41 additions and 73 deletions

View File

@ -3,25 +3,6 @@
// that can be found in the LICENSE file.
module os
#include <sys/stat.h> // #include <signal.h>
#include <errno.h>
/*
struct dirent {
d_ino int
d_off int
d_reclen u16
d_type byte
d_name [256]byte
}
*/
struct C.dirent {
d_name byteptr
}
fn C.readdir(voidptr) C.dirent
pub const (
args = []string{}
max_path_len = 4096
@ -40,39 +21,6 @@ struct FileInfo {
size int
}
struct C.stat {
st_size int
st_mode u32
st_mtime int
}
struct C.DIR {}
// struct C.dirent {
// d_name byteptr
// }
struct C.sigaction {
mut:
sa_mask int
sa_sigaction int
sa_flags int
}
fn C.getline(voidptr, voidptr, voidptr) int
fn C.ftell(fp voidptr) int
fn C.sigaction(int, voidptr, int)
fn C.open(charptr, int, int) int
fn C.fdopen(int, string) voidptr
pub fn (f File) is_opened() bool {
return f.opened
}
@ -206,7 +154,6 @@ pub fn mv(old, new string) {
}
}
fn C.CopyFile(&u32, &u32, int) int
pub fn cp(old, new string) ?bool {
$if windows {
w_old := old.replace('/', '\\')
@ -480,11 +427,6 @@ fn vpclose(f voidptr) int {
}
}
struct Foo2 {
x int
}
pub struct Result {
pub:
exit_code int
@ -950,13 +892,6 @@ pub fn on_segfault(f voidptr) {
}
}
fn C.getpid() int
//fn C.proc_pidpath(int, byteptr, int) int
fn C.readlink() int
// executable returns the path name of the executable that started the current
// process.
pub fn executable() string {
@ -1230,12 +1165,6 @@ pub fn signal(signum int, handler voidptr) {
C.signal(signum, handler)
}
fn C.fork() int
fn C.wait() int
pub fn fork() int {
mut pid := -1
$if !windows {

36
vlib/os/os_c.v Normal file
View File

@ -0,0 +1,36 @@
module os
#include <sys/stat.h> // #include <signal.h>
#include <errno.h>
fn C.readdir(voidptr) C.dirent
fn C.getpid() int
fn C.readlink() int
fn C.getline(voidptr, voidptr, voidptr) int
fn C.ftell(fp voidptr) int
fn C.sigaction(int, voidptr, int)
fn C.open(charptr, int, int) int
fn C.fdopen(int, string) voidptr
fn C.CopyFile(&u32, &u32, int) int
fn C.fork() int
fn C.wait() int
//fn C.proc_pidpath(int, byteptr, int) int
struct C.stat {
st_size int
st_mode u32
st_mtime int
}
struct C.DIR {}
struct C.sigaction {
mut:
sa_mask int
sa_sigaction int
sa_flags int
}
struct C.dirent {
d_name byteptr
}