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

all: variable sized options

This commit is contained in:
Emily Hudson
2020-05-31 11:57:26 +01:00
committed by GitHub
parent 3a36ed3802
commit 75eac291ac
10 changed files with 251 additions and 94 deletions

View File

@@ -798,12 +798,17 @@ pub fn get_raw_stdin() []byte {
for {
pos := buf + offset
res := C.ReadFile(h_input, pos, block_bytes, &bytes_read, 0)
offset += bytes_read
if !res {
break
}
offset += bytes_read
buf = v_realloc(buf, offset + block_bytes + (block_bytes-bytes_read))
}
C.CloseHandle(h_input)
return array{element_size: 1 data: voidptr(buf) len: offset cap: offset }
}
} $else {

View File

@@ -154,3 +154,7 @@ pub fn (mut f File) close() {
C.fflush(f.cfile)
C.fclose(f.cfile)
}
pub fn debugger_present() bool {
return false
}

View File

@@ -345,4 +345,11 @@ pub type VectoredExceptionHandler fn(&ExceptionPointers)u32
pub fn add_vectored_exception_handler(first bool, handler VectoredExceptionHandler) {
C.AddVectoredExceptionHandler(u32(first), handler)
}
}
// this is defined in builtin_windows.c.v in builtin
// fn C.IsDebuggerPresent() bool
pub fn debugger_present() bool {
return C.IsDebuggerPresent()
}