mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-17 00:24:05 +00:00
core:os -> core:os/os2 in core:terminal
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Interaction with the command line interface (`CLI`) of the system.
|
||||
package terminal
|
||||
|
||||
import "core:os"
|
||||
import os "core:os/os2"
|
||||
|
||||
/*
|
||||
This describes the range of colors that a terminal is capable of supporting.
|
||||
@@ -15,14 +15,14 @@ Color_Depth :: enum {
|
||||
}
|
||||
|
||||
/*
|
||||
Returns true if the file `handle` is attached to a terminal.
|
||||
Returns true if the `File` is attached to a terminal.
|
||||
|
||||
This is normally true for `os.stdout` and `os.stderr` unless they are
|
||||
redirected to a file.
|
||||
*/
|
||||
@(require_results)
|
||||
is_terminal :: proc(handle: os.Handle) -> bool {
|
||||
return _is_terminal(handle)
|
||||
is_terminal :: proc(f: ^os.File) -> bool {
|
||||
return _is_terminal(f)
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
#+build js
|
||||
package terminal
|
||||
|
||||
import "core:os"
|
||||
|
||||
_is_terminal :: proc "contextless" (handle: os.Handle) -> bool {
|
||||
_is_terminal :: proc "contextless" (handle: any) -> bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
|
||||
package terminal
|
||||
|
||||
import "base:runtime"
|
||||
import "core:os"
|
||||
import "core:sys/posix"
|
||||
import "base:runtime"
|
||||
import os "core:os/os2"
|
||||
import "core:sys/posix"
|
||||
|
||||
_is_terminal :: proc "contextless" (handle: os.Handle) -> bool {
|
||||
return bool(posix.isatty(posix.FD(handle)))
|
||||
_is_terminal :: proc "contextless" (f: ^os.File) -> bool {
|
||||
context = runtime.default_context()
|
||||
fd := os.fd(f)
|
||||
is_tty := posix.isatty(posix.FD(fd))
|
||||
return bool(is_tty)
|
||||
}
|
||||
|
||||
_init_terminal :: proc "contextless" () {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#+private
|
||||
package terminal
|
||||
|
||||
import "base:runtime"
|
||||
import "core:os"
|
||||
import "core:sys/windows"
|
||||
import "base:runtime"
|
||||
import os "core:os/os2"
|
||||
import "core:sys/windows"
|
||||
|
||||
_is_terminal :: proc "contextless" (handle: os.Handle) -> bool {
|
||||
is_tty := windows.GetFileType(windows.HANDLE(handle)) == windows.FILE_TYPE_CHAR
|
||||
_is_terminal :: proc "contextless" (f: ^os.File) -> bool {
|
||||
context = runtime.default_context()
|
||||
fd := os.fd(f)
|
||||
is_tty := windows.GetFileType(windows.HANDLE(fd)) == windows.FILE_TYPE_CHAR
|
||||
return is_tty
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user