Debian Codegraph @

vendor/opam/src/core/opamStubs.mli

raw
1 (**************************************************************************)
2 (* *)
3 (* Copyright 2018 MetaStack Solutions Ltd. *)
4 (* *)
5 (* All rights reserved. This file is distributed under the terms of the *)
6 (* GNU Lesser General Public License version 2.1, with the special *)
7 (* exception on linking described in the file LICENSE. *)
8 (* *)
9 (**************************************************************************)
10
11 (** OS-specific functions requiring C code on at least one platform.
12
13 Most functions are Windows-specific and raise an exception on other
14 platforms. *)
15
16 include module type of struct include OpamStubsTypes end
17
18 val getpid : unit -> int
19 (** On Windows, this returns the actual process ID, rather than the non-unique
20 faked process ID returned by the Microsoft C Runtime
21 (see https://caml.inria.fr/mantis/view.php?id=4034).
22
23 On all other platforms, this is just an alias for [Unix.getpid]. *)
24
25 val getCurrentProcessID : unit -> int32
26 (** Windows only. As {!getpid}, but without the possibility of truncating the
27 ID on 32-bit platforms. *)
28
29 val getStdHandle : stdhandle -> handle
30 (** Windows only. Return a standard handle. *)
31
32 val getConsoleScreenBufferInfo : handle -> console_screen_buffer_info
33 (** Windows only. Return current Console screen buffer information. *)
34
35 val setConsoleTextAttribute : handle -> int -> unit
36 (** Windows only. Set the console's text attribute setting. *)
37
38 val fillConsoleOutputCharacter : handle -> char -> int -> int * int -> bool
39 (** Windows only. [fillConsoleOutputCharacter buffer c n (x, y)] writes [c]
40 [n] times starting at the given coordinate (and wrapping if required). *)
41
42 val getConsoleMode : handle -> int
43 (** Windows only. Returns the input/output mode of the console screen buffer
44 referred to by the handle.
45
46 @raise Not_found If the handle does not refer to a console. *)
47
48 val setConsoleMode : handle -> int -> bool
49 (** Windows only. Sets the input/output mode of the console screen buffer
50 referred to by the handle, returning [true] if the operation isr
51 successful. *)
52
53 val getWindowsVersion : unit -> int * int * int * int
54 (** Windows only. Returns the Windows version as
55 [(major, minor, build, revision)]. This function only works if opam is
56 compiled OCaml 4.06.0 or later, it returns [(0, 0, 0, 0)] otherwise. *)
57
58 val getArchitecture : unit -> windows_cpu_architecture
59 (** Windows only. Equivalent of [uname -m]. *)
60
61 val waitpids : int list -> int -> int * Unix.process_status
62 (** Windows only. Given a list [pids] with [length] elements,
63 [waitpids pids length] behaves like [Unix.wait], returning the pid and
64 exit status of the first process to terminate. *)
65
66 val writeRegistry :
67 registry_root -> string -> string -> 'a registry_value -> 'a -> unit
68 (** Windows only. [writeRegistry root key name value_type value] sets the
69 value [name] of type [value_type] in registry key [key] of [root] to
70 [value].
71
72 @raise Failure If the value could not be set.
73 @raise Not_found If [key] does not exist. *)
74
75 val getConsoleOutputCP : unit -> int
76 (** Windows only. Retrieves the current Console Output Code Page. *)
77
78 val getCurrentConsoleFontEx : handle -> bool -> console_font_infoex
79 (** Windows only. Gets information on the current console output font. *)
80
81 val create_glyph_checker : string -> handle * handle
82 (** Windows only. Given a font name, returns a pair consisting of a screen DC
83 and a font object, which will have been selected into the DC.
84
85 @raise Failure If anything goes wrong with the GDI calls. *)
86
87 val delete_glyph_checker : handle * handle -> unit
88 (** Windows only. Given [(dc, font)], deletes the font object and releases the
89 DC. *)
90
91 val has_glyph : handle * handle -> Uchar.t -> bool
92 (** Windows only. [has_glyph (dc, font) scalar] returns [true] if [font]
93 contains a glyph for [scalar].
94
95 @raise Failure If the call to [GetGlyphIndicesW] fails. *)
96
97 val getProcessArchitecture : int32 option -> windows_cpu_architecture
98 (** Windows only. Returns the CPU architecture of the given process ID (or the
99 current process). *)
100
101 val process_putenv : int32 -> string -> string -> bool
102 (** Windows only. [process_putenv pid name value] sets the environment variable
103 [name] to [value] in given process ID ([Unix.putenv] must also be called to
104 update the value in the current process). This function must not be called
105 if the target process is 32-bit and the current process is 64-bit or vice
106 versa (outcomes vary from a no-op to a segfault). *)
107
108 val shGetFolderPath : int -> shGFP_type -> string
109 (** Windows only. [shGetFolderPath nFolder dwFlags] retrieves the location of a special
110 folder by CSIDL value. See https://msdn.microsoft.com/en-us/library/windows/desktop/bb762181.aspx *)
111
112 val sendMessageTimeout :
113 nativeint -> int -> int -> ('a, 'b, 'c) winmessage -> 'a -> 'b -> int * 'c
114 (** Windows only. [sendMessageTimeout hwnd timeout flags message wParam lParam]
115 sends a message to the given handle, but is guaranteed to return within
116 [timeout] milliseconds. The result consists of two parts, [fst] is the
117 return value from SendMessageTimeout, [snd] depends on both the message and
118 [fst]. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms644952.aspx *)
119
120 val getProcessAncestry : unit -> (int32 * string) list
121 (** Windows only. Returns the pid and full path to the image for each entry in
122 the ancestry list for this process, starting with the process itself. If an
123 image name can't be determined, then [""] is returned; on failure, returns
124 [[]]. *)
125
126 val getConsoleAlias : string -> string -> string
127 (** Windows only. [getConsoleAlias alias exeName] retrieves the value for a
128 given executable or [""] if the alias is not defined. See
129 https://docs.microsoft.com/en-us/windows/console/getconsolealias *)
130
131 val win_create_process : string -> string -> string option -> Unix.file_descr ->
132 Unix.file_descr -> Unix.file_descr -> int
133 (** Windows only. Provided by OCaml's win32unix library. *)
134
135 val getConsoleWindowClass : unit -> string option
136 (** Windows only. Returns the name of the class for the Console window or [None]
137 if there is no console. *)