Module Terminal.Descr

module Descr: sig .. end

Operations on Unix.file_descr. Descr.any_func fd is equal to any_func (Unix.out_channel_of_descr fd) or any_func (Unix.in_channel_of_descr fd). This module has the additional output function output_newline, and the additional input functions is_empty and input_event for event handling.


val is_terminal : Unix.file_descr -> bool

Same as Unix.isatty.

Output file_descr

val size : Unix.file_descr -> int * int
val set_size : Unix.file_descr -> int -> int -> unit
val view : Unix.file_descr -> int * int * int * int
val position : Unix.file_descr -> int * int
val set_position : Unix.file_descr -> int -> int -> unit
val move : Unix.file_descr -> int -> int -> unit
val move_to_bol : Unix.file_descr -> unit -> unit
val color : Unix.file_descr ->
?reset:bool ->
?bold:bool ->
?underscore:bool ->
?blink:bool ->
?reverse:bool ->
?concealed:bool ->
?foreground:Terminal.color -> ?background:Terminal.color -> unit -> unit
val save : Unix.file_descr -> (unit -> 'a) -> 'a
val clear_screen : Unix.file_descr -> unit -> unit
val clear_eol : Unix.file_descr -> unit -> unit
val clear_line : Unix.file_descr -> unit -> unit
val scroll : Unix.file_descr -> int -> unit
val show_cursor : Unix.file_descr -> bool -> unit
val wrap : Unix.file_descr -> bool -> unit
val screen : Unix.file_descr ->
?size:int * int ->
?cursor:bool -> ?wrap:bool -> (Unix.file_descr -> 'a) -> 'a
val output : Unix.file_descr -> bytes -> int -> int -> unit

Same as Unix.write, but the returned type is unit.

val output_substring : Unix.file_descr -> string -> int -> int -> unit

Same as output but take a string instead of a bytes.

val output_string : Unix.file_descr -> string -> unit

Same as output_substring fd s 0 (String.length s).

val output_substring_utf8 : Unix.file_descr -> string -> int -> int -> unit
val output_string_utf8 : Unix.file_descr -> string -> unit
val output_newline : Unix.file_descr -> unit -> unit

Write "\n" (in POSIX) or "\r\n" (in Windows).

Input file_descr

val mode : Unix.file_descr ->
?echo:bool ->
?canonical:bool -> ?control_c:bool -> ?mouse:bool -> (unit -> 'a) -> 'a
val input : Unix.file_descr -> bytes -> int -> int -> int

Same as Unix.read.

val input_line_utf8 : Unix.file_descr -> string
val is_empty : Unix.file_descr -> bool

Check whether a given file descriptor is empty or having any events.

val input_event : Unix.file_descr -> Terminal.event

Read one event from a given file descriptor.