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

@ -4,10 +4,11 @@
module gl module gl
// import os
import gx import gx
import glm import glm
// import os
// import darwin // import darwin
pub struct Shader { pub struct Shader {

View File

@ -3,25 +3,6 @@
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
module os 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 ( pub const (
args = []string{} args = []string{}
max_path_len = 4096 max_path_len = 4096
@ -40,39 +21,6 @@ struct FileInfo {
size int 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 { pub fn (f File) is_opened() bool {
return f.opened 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 { pub fn cp(old, new string) ?bool {
$if windows { $if windows {
w_old := old.replace('/', '\\') w_old := old.replace('/', '\\')
@ -480,11 +427,6 @@ fn vpclose(f voidptr) int {
} }
} }
struct Foo2 {
x int
}
pub struct Result { pub struct Result {
pub: pub:
exit_code int 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 // executable returns the path name of the executable that started the current
// process. // process.
pub fn executable() string { pub fn executable() string {
@ -1230,12 +1165,6 @@ pub fn signal(signum int, handler voidptr) {
C.signal(signum, handler) C.signal(signum, handler)
} }
fn C.fork() int
fn C.wait() int
pub fn fork() int { pub fn fork() int {
mut pid := -1 mut pid := -1
$if !windows { $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
}

View File

@ -1,4 +1,7 @@
module sync module sync
import runtime
// * Goal: this file provides a convenient way to run identical tasks over a list // * Goal: this file provides a convenient way to run identical tasks over a list
// * of items in parallel, without worrying about waitgroups, mutexes and so on. // * of items in parallel, without worrying about waitgroups, mutexes and so on.
// * // *
@ -36,7 +39,6 @@ module sync
// * 2) idx - the index of the currently processed item // * 2) idx - the index of the currently processed item
// * 3) task_id - the index of the worker thread in which the callback // * 3) task_id - the index of the worker thread in which the callback
// * function is running. // * function is running.
import runtime
pub const ( pub const (
no_result = voidptr(0) no_result = voidptr(0)