package goblint

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Prelude.AnaSource

include module type of struct include All end
include module type of Batteries with module Format := Batteries.Format
Sourcemodule Legacy = All.Legacy
Sourcemodule Array = All.Array
Sourcemodule Buffer = All.Buffer
Sourcemodule Bytes = All.Bytes
Sourcetype bytes = Bytes.t
Sourcemodule Char = All.Char
Sourcemodule Complex = All.Complex
Sourcemodule Digest = All.Digest
Sourcemodule Either = All.Either
Sourcemodule Gc = All.Gc
Sourcemodule Genlex = All.Genlex
Sourcemodule Hashtbl = All.Hashtbl
Sourcemodule Int32 = All.Int32
Sourcemodule Int64 = All.Int64
Sourcemodule Lexing = All.Lexing
Sourcemodule List = All.List
Sourcemodule Map = All.Map
Sourcemodule Marshal = All.Marshal
Sourcemodule Nativeint = All.Nativeint
Sourcemodule Printexc = All.Printexc
Sourcemodule Printf = All.Printf
Sourcemodule Queue = All.Queue
Sourcemodule Random = All.Random
Sourcemodule Scanf = All.Scanf
Sourcemodule Set = All.Set
Sourcemodule Stack = All.Stack
Sourcemodule Stream = All.Stream
Sourcemodule String = All.String
Sourcemodule Sys = All.Sys
Sourcemodule Unix = All.Unix
Sourcemodule Big_int = All.Big_int
Sourcemodule Num = All.Num
Sourcemodule Bigarray = All.Bigarray
Sourcemodule Base64 = All.Base64
Sourcemodule BitSet = All.BitSet
Sourcemodule Bit_set = All.Bit_set
Sourcemodule Dllist = All.Dllist
Sourcemodule DynArray = All.DynArray
Sourcemodule Enum = All.Enum
Sourcemodule File = All.File
Sourcemodule Global = All.Global
Sourcemodule IO = All.IO
Sourcemodule LazyList = All.LazyList
Sourcemodule MultiPMap = All.MultiPMap
Sourcemodule Option = All.Option
Sourcemodule RefList = All.RefList
Sourcemodule Ref = All.Ref
Sourcemodule Cache = All.Cache
Sourcemodule CharParser = All.CharParser
Sourcemodule Deque = All.Deque
Sourcemodule Hashcons = All.Hashcons
Sourcemodule Heap = All.Heap
Sourcemodule FingerTree = All.FingerTree
Sourcemodule Logger = All.Logger
Sourcemodule MultiMap = All.MultiMap
Sourcemodule ParserCo = All.ParserCo
Sourcemodule Result = All.Result
Sourcemodule Return = All.Return
Sourcemodule Seq = All.Seq
Sourcemodule Substring = All.Substring
Sourcemodule Tuple = All.Tuple
Sourcemodule Tuple2 = All.Tuple2
Sourcemodule Tuple3 = All.Tuple3
Sourcemodule Tuple4 = All.Tuple4
Sourcemodule Tuple5 = All.Tuple5
Sourcemodule Vect = All.Vect
Sourcemodule ISet = All.ISet
Sourcemodule IMap = All.IMap
Sourcemodule Splay = All.Splay
Sourcemodule Uref = All.Uref
Sourcemodule UChar = All.UChar
Sourcemodule UTF8 = All.UTF8
Sourcemodule Text = All.Text
Sourcemodule Concurrent = All.Concurrent
Sourcemodule Interfaces = All.Interfaces
Sourcemodule Number = All.Number
Sourcemodule Float = All.Float
Sourcemodule Int = All.Int
Sourcemodule Bool = All.Bool
Sourcemodule Unit = All.Unit
Sourcemodule Filename = All.Filename
Sourcemodule Incubator = All.Incubator
include module type of Pervasives with type ('a, 'b) result := ('a, 'b) Pervasives.result and type 'a ref = 'a Pervasives.ref and type fpclass = Pervasives.fpclass and type in_channel = Pervasives.in_channel and type out_channel = Pervasives.out_channel and type open_flag = Pervasives.open_flag and type ('a, 'b, 'c, 'd, 'e, 'f) format6 = ('a, 'b, 'c, 'd, 'e, 'f) Pervasives.format6 and type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'd) Pervasives.format4 and type ('a, 'b, 'c) format = ('a, 'b, 'c) Pervasives.format
Sourceval raise : exn -> 'a
Sourceval raise_notrace : exn -> 'a
Sourceval invalid_arg : string -> 'a
Sourceval failwith : string -> 'a
Sourceexception Exit
Sourceval (=) : 'a -> 'a -> bool
Sourceval (<>) : 'a -> 'a -> bool
Sourceval (<) : 'a -> 'a -> bool
Sourceval (>) : 'a -> 'a -> bool
Sourceval (<=) : 'a -> 'a -> bool
Sourceval (>=) : 'a -> 'a -> bool
Sourceval compare : 'a -> 'a -> int
Sourceval min : 'a -> 'a -> 'a
Sourceval max : 'a -> 'a -> 'a
Sourceval (==) : 'a -> 'a -> bool
Sourceval (!=) : 'a -> 'a -> bool
Sourceval not : bool -> bool
Sourceval (&&) : bool -> bool -> bool
Sourceval (&) : bool -> bool -> bool
  • deprecated Use (&&) instead.
Sourceval (||) : bool -> bool -> bool
Sourceval (or) : bool -> bool -> bool
  • deprecated Use (||) instead.
Sourceval __LOC__ : string
Sourceval __FILE__ : string
Sourceval __LINE__ : int
Sourceval __MODULE__ : string
Sourceval __POS__ : string * int * int * int
Sourceval __LOC_OF__ : 'a -> string * 'a
Sourceval __LINE_OF__ : 'a -> int * 'a
Sourceval __POS_OF__ : 'a -> (string * int * int * int) * 'a
Sourceval (~-) : int -> int
Sourceval (~+) : int -> int
Sourceval succ : int -> int
Sourceval pred : int -> int
Sourceval (+) : int -> int -> int
Sourceval (-) : int -> int -> int
Sourceval (*) : int -> int -> int
Sourceval (/) : int -> int -> int
Sourceval (mod) : int -> int -> int
Sourceval abs : int -> int
Sourceval max_int : int
Sourceval min_int : int
Sourceval (land) : int -> int -> int
Sourceval (lor) : int -> int -> int
Sourceval (lxor) : int -> int -> int
Sourceval lnot : int -> int
Sourceval (lsl) : int -> int -> int
Sourceval (lsr) : int -> int -> int
Sourceval (asr) : int -> int -> int
Sourceval (~-.) : float -> float
Sourceval (~+.) : float -> float
Sourceval (+.) : float -> float -> float
Sourceval (-.) : float -> float -> float
Sourceval (*.) : float -> float -> float
Sourceval (/.) : float -> float -> float
Sourceval (**) : float -> float -> float
Sourceval sqrt : float -> float
Sourceval exp : float -> float
Sourceval log : float -> float
Sourceval log10 : float -> float
Sourceval expm1 : float -> float
Sourceval log1p : float -> float
Sourceval cos : float -> float
Sourceval sin : float -> float
Sourceval tan : float -> float
Sourceval acos : float -> float
Sourceval asin : float -> float
Sourceval atan : float -> float
Sourceval atan2 : float -> float -> float
Sourceval hypot : float -> float -> float
Sourceval cosh : float -> float
Sourceval sinh : float -> float
Sourceval tanh : float -> float
Sourceval ceil : float -> float
Sourceval floor : float -> float
Sourceval abs_float : float -> float
Sourceval copysign : float -> float -> float
Sourceval mod_float : float -> float -> float
Sourceval frexp : float -> float * int
Sourceval ldexp : float -> int -> float
Sourceval modf : float -> float * float
Sourceval float : int -> float
Sourceval float_of_int : int -> float
Sourceval truncate : float -> int
Sourceval int_of_float : float -> int
Sourceval infinity : float
Sourceval neg_infinity : float
Sourceval nan : float
Sourceval max_float : float
Sourceval min_float : float
Sourceval epsilon_float : float
Sourcetype nonrec fpclass = Pervasives.fpclass =
  1. | FP_normal
  2. | FP_subnormal
  3. | FP_zero
  4. | FP_infinite
  5. | FP_nan
Sourceval classify_float : float -> fpclass
Sourceval (^) : string -> string -> string
Sourceval int_of_char : char -> int
Sourceval char_of_int : int -> char
Sourceval ignore : 'a -> unit
Sourceval string_of_bool : bool -> string
Sourceval bool_of_string : string -> bool
Sourceval bool_of_string_opt : string -> bool option
Sourceval string_of_int : int -> string
Sourceval int_of_string : string -> int
Sourceval int_of_string_opt : string -> int option
Sourceval string_of_float : float -> string
Sourceval float_of_string : string -> float
Sourceval float_of_string_opt : string -> float option
Sourceval fst : ('a * 'b) -> 'a
Sourceval snd : ('a * 'b) -> 'b
Sourcetype nonrec in_channel = Pervasives.in_channel
Sourcetype nonrec out_channel = Pervasives.out_channel
Sourceval print_char : char -> unit
Sourceval print_string : string -> unit
Sourceval print_bytes : bytes -> unit
Sourceval print_int : int -> unit
Sourceval print_float : float -> unit
Sourceval print_endline : string -> unit
Sourceval print_newline : unit -> unit
Sourceval prerr_char : char -> unit
Sourceval prerr_string : string -> unit
Sourceval prerr_bytes : bytes -> unit
Sourceval prerr_int : int -> unit
Sourceval prerr_float : float -> unit
Sourceval prerr_endline : string -> unit
Sourceval prerr_newline : unit -> unit
Sourceval read_line : unit -> string
Sourceval read_int : unit -> int
Sourceval read_int_opt : unit -> int option
Sourceval read_float : unit -> float
Sourceval read_float_opt : unit -> float option
Sourcetype nonrec open_flag = Pervasives.open_flag =
  1. | Open_rdonly
  2. | Open_wronly
  3. | Open_append
  4. | Open_creat
  5. | Open_trunc
  6. | Open_excl
  7. | Open_binary
  8. | Open_text
  9. | Open_nonblock
Sourceval output_bytes : out_channel -> bytes -> unit
Sourceval seek_out : out_channel -> int -> unit
Sourceval pos_out : out_channel -> int
Sourceval out_channel_length : out_channel -> int
Sourceval set_binary_mode_out : out_channel -> bool -> unit
Sourceval really_input_string : in_channel -> int -> string
Sourceval seek_in : in_channel -> int -> unit
Sourceval pos_in : in_channel -> int
Sourceval in_channel_length : in_channel -> int
Sourceval set_binary_mode_in : in_channel -> bool -> unit
Sourcemodule LargeFile = All.LargeFile
Sourcetype nonrec 'a ref = 'a Pervasives.ref = {
  1. mutable contents : 'a;
}
Sourceval ref : 'a -> 'a ref
Sourceval (!) : 'a ref -> 'a
Sourceval (:=) : 'a ref -> 'a -> unit
Sourceval incr : int ref -> unit
Sourceval decr : int ref -> unit
Sourcetype ('a, 'b, 'c, 'd, 'e, 'f) format6 = ('a, 'b, 'c, 'd, 'e, 'f) Pervasives.format6
Sourcetype ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'd) Pervasives.format4
Sourcetype ('a, 'b, 'c) format = ('a, 'b, 'c) Pervasives.format
Sourceval string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string
Sourceval format_of_string : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6
Sourceval (^^) : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('f, 'b, 'c, 'e, 'g, 'h) format6 -> ('a, 'b, 'c, 'd, 'g, 'h) format6
Sourceval exit : int -> 'a
Sourceval at_exit : (unit -> unit) -> unit
Sourceval valid_float_lexem : string -> string
Sourceval do_at_exit : unit -> unit
include module type of struct include BatPervasives end

The initially opened module.

This module provides the basic operations over the built-in types (numbers, booleans, strings, exceptions, references, lists, arrays, input-output channels, ...)

This module is automatically opened at the beginning of each compilation. All components of this module can therefore be referred by their short name, without prefixing them by BatPervasives.

  • author Xavier Leroy (Base module)
  • author Nicolas Cannasse
  • author David Teller
  • author Zheng Li
Sourceval input_lines : Pervasives.in_channel -> string BatEnum.t

Returns an enumeration over lines of an input channel, as read by the input_line function.

Sourceval input_chars : Pervasives.in_channel -> char BatEnum.t

Returns an enumeration over characters of an input channel.

Sourceval input_list : Pervasives.in_channel -> string list

Returns the list of lines read from an input channel.

Sourceval input_all : Pervasives.in_channel -> string

Return the whole contents of an input channel as a single string.

Sourceval dump : 'a -> string

Attempt to convert a value to a string.

Works well for a lot of cases such as non-empty lists, algebraic datatype, and records.

However, since types are lost at compile-time, the representation might not match your type. (0, 1) will be printed as expected, but (1, 0) and 1 have the same representation and will get printed in the same way. The result of dump is unspecified and may change in future versions, so you should only use it for debugging and never have program behavior depend on the output.

Here is a list of some of the surprising corner cases of the current implementation:

  • (3, 0) is printed 3, (0.5, 0) is printed 0.5, etc.
  • None, false and are printed 0

dump may fail for ill-formed values, such as obtained from a faulty C binding or crazy uses of Obj.set_tag.

Sourceval print_any : 'b BatIO.output -> 'a -> unit

Attempt to print a value to an output.

Uses dump to convert the value to a string and prints that string to the output.

List operations

More list operations are provided in module List.

Sourceval (@) : 'a list -> 'a list -> 'a list

List concatenation.

Input/output

This section only contains the most common input/output operations. More operations may be found in modules BatIO and File.

Sourceval stdin : BatIO.input

Standard input, as per Unix/Windows conventions (by default, keyboard).

Use this input to read what the user is writing on the keyboard.

Sourceval stdout : unit BatIO.output

Standard output, as per Unix/Windows conventions (by default, console).

Use this output to display regular messages.

Sourceval stderr : unit BatIO.output

Standard error output, as per Unix/Windows conventions.

Use this output to display warnings and error messages.

Sourceval stdnull : unit BatIO.output

An output which discards everything written to it.

Use this output to ignore messages.

Sourceval flush_all : unit -> unit

Write all pending data to output channels, ignore all errors.

It is normally not necessary to call this function, as all pending data is written when an output channel is closed or when the program itself terminates, either normally or because of an uncaught exception. However, this function is useful for debugging, as it forces pending data to be written immediately.

Output functions on standard output

Sourceval print_bool : bool -> unit

Print a boolean on standard output.

Sourceval print_guess : 'a BatIO.output -> 'b -> unit

Attempt to print the representation of a runtime value on the standard output. See remarks for dump. This function is useful mostly for debugging. As a general rule, it should not be used in production code.

Sourceval print_all : BatIO.input -> unit

Print the contents of an input to the standard output.

Output functions on standard error

Sourceval prerr_bool : bool -> unit

Print a boolean to stderr.

Sourceval prerr_guess : 'a -> unit

Attempt to print the representation of a runtime value on the error output. See remarks for dump. This function is useful mostly for debugging.

Sourceval prerr_all : BatIO.input -> unit

Print the contents of an input to the error output.

General output functions

Sourceval output_file : filename:string -> text:string -> unit

creates a filename, write text into it and close it.

Sourceval open_out : ?mode:BatFile.open_out_flag list -> ?perm:BatFile.permission -> string -> unit BatIO.output

Open the named file for writing, and return a new output channel on that file. You will need to close the file once you have finished using it.

You may use optional argument mode to decide whether the output will overwrite the contents of the file (by default) or to add things at the end of the file, whether the file should be created if it does not exist yet (the default) or not, whether this operation should proceed if the file exists already (the default) or not, whether the file should be opened as text (the default) or as binary, and whether the file should be opened for non-blocking operations.

You may use optional argument perm to specify the permissions of the file, as per Unix conventions. By default, files are created with default permissions (which depend on your setup).

  • raises Sys_error

    if the file could not be opened.

Sourceval open_out_bin : string -> unit BatIO.output

Same as open_out, but the file is opened in binary mode, so that no translation takes place during writes. On operating systems that do not distinguish between text mode and binary mode, this function behaves like open_out without any mode or perm.

Sourceval open_out_gen : open_flag list -> int -> string -> unit BatIO.output

open_out_gen mode perm filename opens the named file for writing, as described above. The extra argument mode specifies the opening mode. The extra argument perm specifies the file permissions, in case the file must be created.

  • deprecated

    Use open_outinstead

Sourceval flush : unit BatIO.output -> unit

Flush the buffer associated with the given output, performing all pending writes on that channel. Interactive programs must be careful about flushing standard output and standard error at the right time.

Sourceval output_char : unit BatIO.output -> char -> unit

Write the character on the given output channel.

Sourceval output_string : unit BatIO.output -> string -> unit

Write the string on the given output channel.

Sourceval output : unit BatIO.output -> Bytes.t -> int -> int -> unit

output oc buf pos len writes len characters from byte sequence buf, starting at offset pos, to the given output channel oc.

  • raises Invalid_argument

    if pos and len do not designate a valid subsequence of buf.

Sourceval output_substring : unit BatIO.output -> string -> int -> int -> unit

output_substring oc buf pos len writes len characters from string buf, starting at offset pos, to the given output channel oc.

  • raises Invalid_argument

    if pos and len do not designate a valid substring of buf.

Sourceval output_byte : unit BatIO.output -> int -> unit

Write one 8-bit integer (as the single character with that code) on the given output channel. The given integer is taken modulo 256.

Sourceval output_binary_int : unit BatIO.output -> int -> unit

Write one integer in binary format (4 bytes, big-endian) on the given output channel. The given integer is taken modulo 232. The only reliable way to read it back is through the Pervasives.input_binary_int function. The format is compatible across all machines for a given version of OCaml.

Sourceval output_binary_float : unit BatIO.output -> float -> unit

Write one float in binary format (8 bytes, IEEE 754 double format) on the given output channel. The only reliable way to read it back is through the Pervasives.input_binary_float function. The format is compatible across all machines for a given version of OCaml.

Sourceval output_value : unit BatIO.output -> 'a -> unit

Write the representation of a structured value of any type to a channel. Circularities and sharing inside the value are detected and preserved. The object can be read back, by the function input_value. See the description of module Marshal for more information. output_value is equivalent to Marshal.output with an empty list of flags.

Sourceval close_out : unit BatIO.output -> unit

Close the given channel, flushing all buffered write operations. Output functions raise a Sys_error exception when they are applied to a closed output channel, except close_out and flush, which do nothing when applied to an already closed channel.

  • raises Sys_error

    if the operating system signals an error when flushing or closing.

Sourceval close_out_noerr : unit BatIO.output -> unit

Same as close_out, but ignore all errors.

General input functions

Sourceval input_file : ?bin:bool -> string -> string

returns the data of a given filename.

Sourceval open_in : ?mode:BatFile.open_in_flag list -> ?perm:BatFile.permission -> string -> BatIO.input

Open the named file for reading. You will need to close the file once you have finished using it.

You may use optional argument mode to decide whether the opening should fail if the file doesn't exist yet (by default) or whether the file should be created if it doesn't exist yet, whether the opening should fail if the file already exists or not (by default), whether the file should be read as binary (by default) or as text, and whether reading should be non-blocking.

You may use optional argument perm to specify the permissions of the file, should it be created, as per Unix conventions. By default, files are created with default permissions (which depend on your setup).

  • raises Sys_error

    if the file could not be opened.

Sourceval open_in_bin : string -> BatIO.input

Same as Pervasives.open_in, but the file is opened in binary mode, so that no translation takes place during reads. On operating systems that do not distinguish between text mode and binary mode, this function behaves like Pervasives.open_in.

Sourceval open_in_gen : open_flag list -> int -> string -> BatIO.input

open_in_gen mode perm filename opens the named file for reading, as described above. The extra arguments mode and perm specify the opening mode and file permissions. Pervasives.open_in and Pervasives.open_in_bin are special cases of this function.

  • deprecated

    Use open_ininstead

Sourceval input_char : BatIO.input -> char

Read one character from the given input channel.

  • raises End_of_file

    if there are no more characters to read.

Sourceval input_line : BatIO.input -> string

Read characters from the given input channel, until a newline character is encountered. Return the string of all characters read, without the newline character at the end.

  • raises End_of_file

    if the end of the file is reached at the beginning of line.

Sourceval input : BatIO.input -> Bytes.t -> int -> int -> int

input ic buf pos len reads up to len characters from the given channel ic, storing them in byte sequence buf, starting at character number pos. It returns the actual number of characters read, between 0 and len (inclusive). A return value of 0 means that the end of file was reached. A return value between 0 and len exclusive means that not all requested len characters were read, either because no more characters were available at that time, or because the implementation found it convenient to do a partial read; input must be called again to read the remaining characters, if desired. (See also Pervasives.really_input for reading exactly len characters.)

  • raises Invalid_argument

    if pos and len do not designate a valid subsequence of buf.

Sourceval really_input : BatIO.input -> Bytes.t -> int -> int -> unit

really_input ic buf pos len reads len characters from channel ic, storing them in byte sequence buf, starting at character number pos.

  • raises End_of_file

    if the end of file is reached before len characters have been read.

  • raises Invalid_argument

    if pos and len do not designate a valid subsequence of buf.

Sourceval input_byte : BatIO.input -> int

Same as Pervasives.input_char, but return the 8-bit integer representing the character.

Sourceval input_binary_int : BatIO.input -> int

Read an integer encoded in binary format (4 bytes, big-endian) from the given input channel. See Pervasives.output_binary_int.

  • raises End_of_file

    if an end of file was reached while reading the integer.

Sourceval input_binary_float : BatIO.input -> float

Read a float encoded in binary format (8 bytes, IEEE 754 double format) from the given input channel. See Pervasives.output_binary_float.

  • raises End_of_file

    if an end of file was reached while reading the float.

Sourceval input_value : BatIO.input -> 'a

Read the representation of a structured value, as produced by output_value, and return the corresponding value. This function is identical to Marshal.input; see the description of module Marshal for more information, in particular concerning the lack of type safety.

Sourceval close_in : BatIO.input -> unit

Close the given channel. Input functions raise a Sys_error exception when they are applied to a closed input channel, except close_in, which does nothing when applied to an already closed channel.

  • raises Sys_error

    if the operating system signals an error.

Sourceval close_in_noerr : BatIO.input -> unit

Same as close_in, but ignore all errors.

Fundamental functions and operators

Sourceval identity : 'a -> 'a

The identity function.

Sourceval undefined : ?message:string -> 'a -> 'b

The undefined function.

Evaluating undefined x always fails and raises an exception "Undefined". Optional argument message permits the customization of the error message.

Sourceval (@@) : ('a -> 'b) -> 'a -> 'b

Function application. f @@ x is equivalent to f x. However, it binds less tightly (between :: and =,<,>,etc) and is right-associative, which makes it useful for composing sequences of function calls without too many parentheses. It is similar to Haskell's $. Note that it replaces pre-2.0 **> and <|.

Sourceval (%) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b

Function composition: the mathematical o operator. f % g is fun x -> f (g x). It is similar to Haskell's ..

Examples: the following are equivalent: f (g (h x)), f @@ g @@ h x, f % g % h @@ x.

Sourceval (|>) : 'a -> ('a -> 'b) -> 'b

The "pipe": function application. x |> f is equivalent to f x.

This operator is commonly used to write a function composition by order of evaluation (the order used in object-oriented programming) rather than by inverse order (the order typically used in functional programming).

For instance, g (f x) means "apply f to x, then apply g to the result." The corresponding notation in most object-oriented programming languages would be somewhere along the lines of x.f.g.h(), or "starting from x, apply f, then apply g." In OCaml, using the ( |> ) operator, this is written x |> f |> g |> h.

This operator may also be useful for composing sequences of function calls without too many parentheses.

Sourceval (%>) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c

Piping function composition. f %> g is fun x -> g (f x). Whereas f % g applies g first and f second, f %> g applies f, then g. Note that it plays well with pipes, so for instance x |> f %> g %> h |> i %> j yields the expected result... but in such cases it's still recommended to use |> only. Note that it replaces pre-2.0 |-, which didn't integrate with pipes.

Sourceval (|?) : 'a option -> 'a -> 'a

Like BatOption.default, with the arguments reversed. None |? 10 returns 10, while Some "foo" |? "bar" returns "foo".

Note This operator does not short circuit like ( || ) and ( && ). Both arguments will be evaluated.

  • since 2.0
Sourceval flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c

Argument flipping.

flip f x y is f y x. Don't abuse this function, it may shorten considerably your code but it also has the nasty habit of making it harder to read.

Sourceval curry : (('a * 'b) -> 'c) -> 'a -> 'b -> 'c

Convert a function which accepts a pair of arguments into a function which accepts two arguments.

curry f is fun x y -> f (x,y)

Sourceval uncurry : ('a -> 'b -> 'c) -> ('a * 'b) -> 'c

Convert a function which accepts two arguments into a function which accepts a pair of arguments.

uncurry f is fun (x, y) -> f x y

Sourceval neg : ('a -> bool) -> 'a -> bool

neg p returns a new predicate that is the negation of the given predicate. That is, the new predicate returns false when the input predicate returns true and vice versa. This is for predicates with one argument.

neg p is fun x -> not (p x)

Sourceval neg2 : ('a -> 'b -> bool) -> 'a -> 'b -> bool

as neg but for predicates with two arguments

Sourceval const : 'a -> _ -> 'a

Ignore its second argument.

const x is the function which always returns x.

Sourceval unique : unit -> int

Returns an unique identifier every time it is called.

Note This is thread-safe.

Sourceval tap : ('a -> unit) -> 'a -> 'a

Allows application of a function in the middle of a pipe sequence without disturbing the sequence. x |> tap f evaluates to x, but has the side effect of f x. Useful for debugging.

Sourceval finally : (unit -> unit) -> ('a -> 'b) -> 'a -> 'b

finally fend f x calls f x and then fend() even if f x raised an exception.

Sourceval with_dispose : dispose:('a -> unit) -> ('a -> 'b) -> 'a -> 'b

with_dispose dispose f x invokes f on x, calling dispose x when f terminates (either with a return value or an exception).

Sourceval forever : ('a -> 'b) -> 'a -> unit

forever f x invokes f on x repeatedly (until an exception occurs).

Sourceval ignore_exceptions : ('a -> 'b) -> 'a -> unit

ignore_exceptions f x invokes f on x, ignoring both the returned value and the exceptions that may be raised.

Sourceval verify_arg : bool -> string -> unit

verify_arg condition message will raise Invalid_argument message if condition is false, otherwise it does nothing.

  • since 2.0
Sourceval args : unit -> string BatEnum.t

An enumeration of the arguments passed to this program through the command line.

args () is given by the elements of Sys.argv, minus the first element.

Sourceval exe : string

The name of the current executable.

exe is given by the first argument of Sys.argv

Enumerations

In OCaml Batteries Included, all data structures are enumerable, which means that they support a number of standard operations, transformations, etc. The general manner of enumerating the contents of a data structure is to invoke the enum function of your data structure.

For instance, you may use the foreach loop to apply a function f to all the consecutive elements of a string s. For this purpose, you may write either foreach (String.enum s) f or open String in foreach (enum s) f. Either possibility states that you are enumerating through a character string s. Should you prefer your enumeration to proceed from the end of the string to the beginning, you may replace String.enum with String.backwards. Therefore, either foreach (String.backwards s) f or open String in foreach (backwards s) f will apply f to all the consecutive elements of string s, from the last to the first.

Similarly, you may use List.enum instead of String.enum to visit the elements of a list in the usual order, or List.backwards instead of String.backwards to visit them in the opposite order, or Hashtbl.enum for hash tables, etc.

More operations on enumerations are defined in module BatEnum, including the necessary constructors to make your own structures enumerable.

The various kinds of loops are detailed further in this documentation.

Sourceval foreach : 'a BatEnum.t -> ('a -> unit) -> unit

Imperative loop on an enumeration.

foreach e f applies function f to each successive element of e. For instance, foreach (1 -- 10) print_int invokes function print_int on 1, 2, ..., 10, printing 12345678910.

Note This function is one of the many loops available on enumerations. Other commonly used loops are iter (same usage scenario as foreach, but with different notations), map (convert an enumeration to another enumeration) or fold (flatten an enumeration by applying an operation to each element).

General-purpose loops

The following functions are the three main general-purpose loops available in OCaml. By opposition to the loops available in imperative languages, OCaml loops are regular functions, which may be passed, composed, currified, etc. In particular, each of these loops may be considered either as a manner of applying a function to a data structure or as transforming a function into another function which will act on a whole data structure.

For instance, if f is a function operating on one value, you may lift this function to operate on all values of an enumeration (and consequently on all values of any data structure of OCaml Batteries Included) by applying iter, map or fold to this function.

Sourceval iter : ('a -> unit) -> 'a BatEnum.t -> unit

Imperative loop on an enumeration. This loop is typically used to lift a function with an effect but no meaningful result and get it to work on enumerations.

If f is a function iter f is a function which behaves as f but acts upon enumerations rather than individual elements. As indicated in the type of iter, f must produce values of type unit (i.e. f has no meaningful result) the resulting function produces no meaningful result either.

In other words, iter f is a function which, when applied upon an enumeration e, calls f with each element of e in turn.

For instance, iter f (1 -- 10) invokes function f on 1, 2, ..., 10 and produces value ().

Sourceval map : ('a -> 'b) -> 'a BatEnum.t -> 'b BatEnum.t

Transformation loop on an enumeration, used to build an enumeration from another enumeration. This loop is typically used to transform an enumeration into another enumeration with the same number of elements, in the same order.

If f is a function, map f e is a function which behaves as f but acts upon enumerations rather than individual elements -- and builds a new enumeration from the results of each application.

In other words, map f is a function which, when applied upon an enumeration containing elements e0, e1, ..., produces enumeration f e0, f e1, ...

For instance, if odd is the function which returns true when applied to an odd number or false when applied to an even number, map odd (1 -- 10) produces enumeration true, false, true, ..., false.

Similarly, if square is the function fun x -> x * x, map square (1 -- 10) produces the enumeration of the square numbers of all numbers between 1 and 10.

Sourceval filter_map : ('a -> 'b option) -> 'a BatEnum.t -> 'b BatEnum.t

Similar to a map, except that you can skip over some items of the incoming enumeration by returning None instead of Some value. Think of it as a filter combined with a map.

Sourceval reduce : ('a -> 'a -> 'a) -> 'a BatEnum.t -> 'a

Transformation loop on an enumeration, used to build a single value from an enumeration.

If f is a function and e is an enumeration, reduce f e applies function f to the first two elements of e, then to the result of this expression and to the third element of e, then to the result of this new expression and to the fourth element of e...

In other words, reduce f e returns a0 if e contains only one element a0, otherwise f (... (f (f a0) a1) ...) aN where a0,a1..aN are the elements of e.

For instance, if add is the function fun x y -> x + y, reduce add is the function which computes the sum of the elements of an enumeration -- and doesn't work on empty enumerations. Therefore, reduce add (1 -- 10) produces result 55.

Sourceval fold : ('b -> 'a -> 'b) -> 'b -> 'a BatEnum.t -> 'b

Transformation loop on an enumeration, used to build a single value from an enumeration. This is the most powerful general-purpose loop and also the most complex.

If f is a function, fold f v e applies f v to the first element of e, then, calling acc_1 the result of this operation, applies f acc_1 to the second element of e, then, calling acc_2 the result of this operation, applies f acc_2 to the third element of e...

In other words, fold f v e returns v if e is empty, otherwise f (... (f (f v a0) a1) ...) aN where a0,a1..aN are the elements of e.

For instance, if add is the function fun x y -> x + y, fold add 0 is the function which computes the sum of the elements of an enumeration. Therefore, fold add 0 (1 -- 10) produces result 55.

Sourceval scanl : ('b -> 'a -> 'b) -> 'b -> 'a BatEnum.t -> 'b BatEnum.t

Functional loop on an enumeration, used to build an enumeration from both an enumeration and an initial value. This function may be seen as a variant of fold which returns not only the final result of fold but the enumeration of all the intermediate results of fold.

If f is a function, scanl f v e is applies f v to the first element of e, then, calling acc_1 the result of this operation, applies f acc_1 to the second element of e, then, calling acc_2 the result of this operation, applies f acc_2 to the third element of e...

For instance, if add is the function fun x y -> x + y, scanl add 0 is the function which computes the sum of the elements of an enumeration. Therefore, scanl add 0 (1 -- 10) produces result the enumeration with elements 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55.

Sourceval (/@) : 'a BatEnum.t -> ('a -> 'b) -> 'b BatEnum.t
Sourceval (@/) : ('a -> 'b) -> 'a BatEnum.t -> 'b BatEnum.t

Mapping operators.

These operators have the same meaning as function map but are sometimes more readable than this function, when chaining several transformations in a row.

Sourceval (//@) : 'a BatEnum.t -> ('a -> 'b option) -> 'b BatEnum.t
Sourceval (@//) : ('a -> 'b option) -> 'a BatEnum.t -> 'b BatEnum.t

Map combined with filter. Same as filter_map.

Other operations on enumerations

Sourceval exists : ('a -> bool) -> 'a BatEnum.t -> bool

exists f e returns true if there is some x in e such that f x

Sourceval for_all : ('a -> bool) -> 'a BatEnum.t -> bool

for_all f e returns true if for every x in e, f x is true

Sourceval find : ('a -> bool) -> 'a BatEnum.t -> 'a

find f e returns the first element x of e such that f x returns true, consuming the enumeration up to and including the found element, or, raises Not_found if no such element exists in the enumeration, consuming the whole enumeration in the search.

Since find consumes a prefix of the enumeration, it can be used several times on the same enumeration to find the next element.

  • raises Not_found

    if no element in the whole enumeration satisfies the predicate

Sourceval peek : 'a BatEnum.t -> 'a option

peek e returns None if e is empty or Some x where x is the next element of e. The element is not removed from the enumeration.

Sourceval get : 'a BatEnum.t -> 'a option

get e returns None if e is empty or Some x where x is the next element of e, in which case the element is removed from the enumeration.

Sourceval push : 'a BatEnum.t -> 'a -> unit

push e x will add x at the beginning of e.

Sourceval junk : 'a BatEnum.t -> unit

junk e removes the first element from the enumeration, if any.

Sourceval filter : ('a -> bool) -> 'a BatEnum.t -> 'a BatEnum.t

filter f e returns an enumeration over all elements x of e such as f x returns true.

Sourceval (//) : 'a BatEnum.t -> ('a -> bool) -> 'a BatEnum.t

Filtering (pronounce this operator name "such that").

For instance, (1 -- 37) // odd is the enumeration of all odd numbers between 1 and 37.

Sourceval (--) : int -> int -> int BatEnum.t

Enumerate numbers.

5 -- 10 is the enumeration 5,6,7,8,9,10. 10 -- 5 is the empty enumeration

Sourceval (--^) : int -> int -> int BatEnum.t

Enumerate numbers, without the right endpoint

5 -- 10 is the enumeration 5,6,7,8,9.

Sourceval (--.) : (float * float) -> float -> float BatEnum.t

(a, step) --. b) creates a float enumeration from a to b with an increment of step between elements.

(5.0, 1.0) --. 10.0 is the enumeration 5.0,6.0,7.0,8.0,9.0,10.0. (10.0, -1.0) --. 5.0 is the enumeration 10.0,9.0,8.0,7.0,6.0,5.0. (10.0, 1.0) --. 1.0 is the empty enumeration.

Sourceval (---) : int -> int -> int BatEnum.t

As --, but accepts enumerations in reverse order.

5 --- 10 is the enumeration 5,6,7,8,9,10. 10 --- 5 is the enumeration 10,9,8,7,6,5.

Sourceval (--~) : char -> char -> char BatEnum.t

As ( -- ), but for characters.

Sourceval print : ?first:string -> ?last:string -> ?sep:string -> ('a BatInnerIO.output -> 'b -> unit) -> 'a BatInnerIO.output -> 'b BatEnum.t -> unit

Print and consume the contents of an enumeration.

Results

Sourcetype ('a, 'e) result = ('a, 'e) BatInnerPervasives.result =
  1. | Ok of 'a
  2. | Error of 'e
    (*

    The result of a computation - either an Ok with the normal result or a Error with some value (often an exception) containing failure information

    *)

This type represents the outcome of a function which has the possibility of failure. Normal results of type 'a are marked with Ok, while failure values of type 'b are marked with Error.

This is intended to be a safer alternative to functions raising exceptions to signal failure. It is safer in that the possibility of failure has to be handled before the result of that computation can be used.

For more functions related to this type, see the BatResult module.

Sourceval ignore_ok : ('a, exn) result -> unit

ignore_ok (f x) ignores the result of f x if it's ok, but throws the exception contained if Error is returned.

Sourceval ok : ('a, exn) result -> 'a

f x |> ok unwraps the Ok result of f x and returns it, or throws the exception contained if Error is returned.

Sourceval wrap : ('a -> 'b) -> 'a -> ('b, exn) result

wrap f x wraps a function that would normally throw an exception on failure such that it now returns a result with either the Ok return value or the Error exception.

Thread-safety internals

Unless you are attempting to adapt Batteries Included to a new model of concurrency, you probably won't need this.

A lock used to synchronize internal operations.

By default, this is BatConcurrent.nolock. However, if you're using a version of Batteries compiled in threaded mode, this uses BatMutex. If you're attempting to use Batteries with another concurrency model, set the lock appropriately.

Sourcemodule Format = All.Format
Sourceval comp2 : ('a -> 'a -> 'b) -> ('c -> 'a) -> 'c -> 'c -> 'b
Sourceval compareBy : ?cmp:('a -> 'a -> int) -> ('b -> 'a) -> 'b -> 'b -> int
Sourceval str_remove : string -> string -> string
Sourceval split_time : unit -> int * int * int * int
Sourceval string_of_time : unit -> string
Sourceval localtime : unit -> string
include module type of struct include GoblintCil end
val initCIL : unit -> unit
val cilVersion : string
type file = GoblintCil__Cil.file = {
  1. mutable fileName : string;
  2. mutable globals : global list;
  3. mutable globinit : fundec option;
  4. mutable globinitcalled : bool;
}
and comment = location * string
and global = GoblintCil__Cil.global =
  1. | GType of typeinfo * location
  2. | GCompTag of compinfo * location
  3. | GCompTagDecl of compinfo * location
  4. | GEnumTag of enuminfo * location
  5. | GEnumTagDecl of enuminfo * location
  6. | GVarDecl of varinfo * location
  7. | GVar of varinfo * initinfo * location
  8. | GFun of fundec * location
  9. | GAsm of string * location
  10. | GPragma of attribute * location
  11. | GText of string
and typ = GoblintCil__Cil.typ =
  1. | TVoid of attributes
  2. | TInt of ikind * attributes
  3. | TFloat of fkind * attributes
  4. | TPtr of typ * attributes
  5. | TArray of typ * exp option * attributes
  6. | TFun of typ * (string * typ * attributes) list option * bool * attributes
  7. | TNamed of typeinfo * attributes
  8. | TComp of compinfo * attributes
  9. | TEnum of enuminfo * attributes
  10. | TBuiltin_va_list of attributes
and ikind = GoblintCil__Cil.ikind =
  1. | IChar
  2. | ISChar
  3. | IUChar
  4. | IBool
  5. | IInt
  6. | IUInt
  7. | IShort
  8. | IUShort
  9. | ILong
  10. | IULong
  11. | ILongLong
  12. | IULongLong
  13. | IInt128
  14. | IUInt128
and fkind = GoblintCil__Cil.fkind =
  1. | FFloat
  2. | FDouble
  3. | FLongDouble
  4. | FComplexFloat
  5. | FComplexDouble
  6. | FComplexLongDouble
and attribute = GoblintCil__Cil.attribute =
  1. | Attr of string * attrparam list
and attributes = attribute list
and attrparam = GoblintCil__Cil.attrparam =
  1. | AInt of int
  2. | AStr of string
  3. | ACons of string * attrparam list
  4. | ASizeOf of typ
  5. | ASizeOfE of attrparam
  6. | ASizeOfS of typsig
  7. | AAlignOf of typ
  8. | AAlignOfE of attrparam
  9. | AAlignOfS of typsig
  10. | AUnOp of unop * attrparam
  11. | ABinOp of binop * attrparam * attrparam
  12. | ADot of attrparam * string
  13. | AStar of attrparam
  14. | AAddrOf of attrparam
  15. | AIndex of attrparam * attrparam
  16. | AQuestion of attrparam * attrparam * attrparam
and compinfo = GoblintCil__Cil.compinfo = {
  1. mutable cstruct : bool;
  2. mutable cname : string;
  3. mutable ckey : int;
  4. mutable cfields : fieldinfo list;
  5. mutable cattr : attributes;
  6. mutable cdefined : bool;
  7. mutable creferenced : bool;
}
and fieldinfo = GoblintCil__Cil.fieldinfo = {
  1. mutable fcomp : compinfo;
  2. mutable fname : string;
  3. mutable ftype : typ;
  4. mutable fbitfield : int option;
  5. mutable fattr : attributes;
  6. mutable floc : location;
}
and enuminfo = GoblintCil__Cil.enuminfo = {
  1. mutable ename : string;
  2. mutable eitems : (string * exp * location) list;
  3. mutable eattr : attributes;
  4. mutable ereferenced : bool;
  5. mutable ekind : ikind;
}
and typeinfo = GoblintCil__Cil.typeinfo = {
  1. mutable tname : string;
  2. mutable ttype : typ;
  3. mutable treferenced : bool;
}
and varinfo = GoblintCil__Cil.varinfo = {
  1. mutable vname : string;
  2. mutable vtype : typ;
  3. mutable vattr : attributes;
  4. mutable vstorage : storage;
  5. mutable vglob : bool;
  6. mutable vinline : bool;
  7. mutable vdecl : location;
  8. vinit : initinfo;
  9. mutable vid : int;
  10. mutable vaddrof : bool;
  11. mutable vreferenced : bool;
  12. mutable vdescr : GoblintCil__.Pretty.doc;
  13. mutable vdescrpure : bool;
  14. mutable vhasdeclinstruction : bool;
}
and storage = GoblintCil__Cil.storage =
  1. | NoStorage
  2. | Static
  3. | Register
  4. | Extern
and exp = GoblintCil__Cil.exp =
  1. | Const of constant
  2. | Lval of lval
  3. | SizeOf of typ
  4. | Real of exp
  5. | Imag of exp
  6. | SizeOfE of exp
  7. | SizeOfStr of string
  8. | AlignOf of typ
  9. | AlignOfE of exp
  10. | UnOp of unop * exp * typ
  11. | BinOp of binop * exp * exp * typ
  12. | Question of exp * exp * exp * typ
  13. | CastE of typ * exp
  14. | AddrOf of lval
  15. | AddrOfLabel of stmt ref
  16. | StartOf of lval
and wstring_type = GoblintCil__Cil.wstring_type =
  1. | Wchar_t
  2. | Char16_t
  3. | Char32_t
and encoding = GoblintCil__Cil.encoding =
  1. | No_encoding
  2. | Utf8
and constant = GoblintCil__Cil.constant =
  1. | CInt of GoblintCil__.Cilint.cilint * ikind * string option
  2. | CStr of string * encoding
  3. | CWStr of int64 list * wstring_type
  4. | CChr of char
  5. | CReal of float * fkind * string option
  6. | CEnum of exp * string * enuminfo
and unop = GoblintCil__Cil.unop =
  1. | Neg
  2. | BNot
  3. | LNot
and binop = GoblintCil__Cil.binop =
  1. | PlusA
  2. | PlusPI
  3. | IndexPI
  4. | MinusA
  5. | MinusPI
  6. | MinusPP
  7. | Mult
  8. | Div
  9. | Mod
  10. | Shiftlt
  11. | Shiftrt
  12. | Lt
  13. | Gt
  14. | Le
  15. | Ge
  16. | Eq
  17. | Ne
  18. | BAnd
  19. | BXor
  20. | BOr
  21. | LAnd
  22. | LOr
and lval = lhost * offset
and lhost = GoblintCil__Cil.lhost =
  1. | Var of varinfo
  2. | Mem of exp
and offset = GoblintCil__Cil.offset =
  1. | NoOffset
  2. | Field of fieldinfo * offset
  3. | Index of exp * offset
and init = GoblintCil__Cil.init =
  1. | SingleInit of exp
  2. | CompoundInit of typ * (offset * init) list
and initinfo = GoblintCil__Cil.initinfo = {
  1. mutable init : init option;
}
and fundec = GoblintCil__Cil.fundec = {
  1. mutable svar : varinfo;
  2. mutable sformals : varinfo list;
  3. mutable slocals : varinfo list;
  4. mutable smaxid : int;
  5. mutable sbody : block;
  6. mutable smaxstmtid : int option;
  7. mutable sallstmts : stmt list;
}
and block = GoblintCil__Cil.block = {
  1. mutable battrs : attributes;
  2. mutable bstmts : stmt list;
}
and stmt = GoblintCil__Cil.stmt = {
  1. mutable labels : label list;
  2. mutable skind : stmtkind;
  3. mutable sid : int;
  4. mutable succs : stmt list;
  5. mutable preds : stmt list;
  6. mutable fallthrough : stmt option;
}
and label = GoblintCil__Cil.label =
  1. | Label of string * location * bool
  2. | Case of exp * location * location
  3. | CaseRange of exp * exp * location * location
  4. | Default of location * location
and stmtkind = GoblintCil__Cil.stmtkind =
  1. | Instr of instr list
  2. | Return of exp option * location
  3. | Goto of stmt ref * location
  4. | ComputedGoto of exp * location
  5. | Break of location
  6. | Continue of location
  7. | If of exp * block * block * location * location
  8. | Switch of exp * block * stmt list * location * location
  9. | Loop of block * location * location * stmt option * stmt option
  10. | Block of block
and instr = GoblintCil__Cil.instr =
  1. | Set of lval * exp * location * location
  2. | VarDecl of varinfo * location
  3. | Call of lval option * exp * exp list * location * location
  4. | Asm of attributes * string list * (string option * string * lval) list * (string option * string * exp) list * string list * location
and location = GoblintCil__Cil.location = {
  1. line : int;
  2. file : string;
  3. byte : int;
  4. column : int;
  5. endLine : int;
  6. endByte : int;
  7. endColumn : int;
  8. synthetic : bool;
}
and typsig = GoblintCil__Cil.typsig =
  1. | TSArray of typsig * GoblintCil__.Cilint.cilint option * attribute list
  2. | TSPtr of typsig * attribute list
  3. | TSComp of bool * string * attribute list
  4. | TSFun of typsig * typsig list option * bool * attribute list
  5. | TSEnum of string * attribute list
  6. | TSBase of typ
val lowerConstants : bool ref
val removeBranchingOnConstants : bool ref
val insertImplicitCasts : bool ref
val compareLoc : location -> location -> int
val emptyFunction : string -> fundec
val setFormals : fundec -> varinfo list -> unit
val setFunctionType : fundec -> typ -> unit
val setFunctionTypeMakeFormals : fundec -> typ -> unit
val setMaxId : fundec -> unit
val dummyFunDec : fundec
val dummyFile : file
val saveBinaryFile : file -> string -> unit
val saveBinaryFileChannel : file -> out_channel -> unit
val loadBinaryFile : string -> file
val getGlobInit : ?main_name:string -> file -> fundec
val iterGlobals : file -> (global -> unit) -> unit
val foldGlobals : file -> ('a -> global -> 'a) -> 'a -> 'a
val mapGlobals : file -> (global -> global) -> unit
val findOrCreateFunc : file -> string -> typ -> varinfo
val new_sid : unit -> int
val prepareCFG : fundec -> unit
val computeCFGInfo : fundec -> bool -> unit
val copyFunction : fundec -> string -> fundec
val pushGlobal : global -> types:global list ref -> variables:global list ref -> unit
val invalidStmt : stmt
val builtinFunctions : (string, typ * typ list * bool) Hashtbl.t
val builtinLoc : location
val makeZeroInit : typ -> init
val foldLeftCompound : implicit:bool -> doinit:(offset -> init -> typ -> 'a -> 'a) -> ct:typ -> initl:(offset * init) list -> acc:'a -> 'a
val voidType : typ
val isVoidType : typ -> bool
val isVoidPtrType : typ -> bool
val typeOfRealAndImagComponents : typ -> typ
val getComplexFkind : fkind -> fkind
val intType : typ
val uintType : typ
val longType : typ
val ulongType : typ
val charType : typ
val charPtrType : typ
val stringLiteralType : typ
val wcharKind : ikind ref
val wcharType : typ ref
val char16Kind : ikind ref
val char16Type : typ ref
val char32Kind : ikind ref
val char32Type : typ ref
val charConstPtrType : typ
val voidPtrType : typ
val intPtrType : typ
val uintPtrType : typ
val doubleType : typ
val upointType : typ ref
val ptrdiffType : typ ref
val typeOfSizeOf : typ ref
val kindOfSizeOf : ikind ref
val isSigned : ikind -> bool
val mkCompInfo : bool -> string -> (compinfo -> (string * typ * int option * attributes * location) list) -> attributes -> compinfo
val copyCompInfo : compinfo -> string -> compinfo
val missingFieldName : string
val compFullName : compinfo -> string
val isCompleteType : typ -> bool
val unrollType : typ -> typ
val unrollTypeDeep : typ -> typ
val isIntegralType : typ -> bool
val isArithmeticType : typ -> bool
val isPointerType : typ -> bool
val isScalarType : typ -> bool
val isFunctionType : typ -> bool
val argsToList : (string * typ * attributes) list option -> (string * typ * attributes) list
val isArrayType : typ -> bool
exception LenOfArray
val lenOfArray : exp option -> int
val getCompField : compinfo -> string -> fieldinfo
type existsAction = GoblintCil__Cil.existsAction =
  1. | ExistsTrue
  2. | ExistsFalse
  3. | ExistsMaybe
val existsType : (typ -> existsAction) -> typ -> bool
val splitFunctionType : typ -> typ * (string * typ * attributes) list option * bool * attributes
val splitFunctionTypeVI : varinfo -> typ * (string * typ * attributes) list option * bool * attributes
val d_typsig : unit -> typsig -> GoblintCil__.Pretty.doc
val typeSig : typ -> typsig
val typeSigWithAttrs : ?ignoreSign:bool -> (attributes -> attributes) -> typ -> typsig
val setTypeSigAttrs : attributes -> typsig -> typsig
val typeSigAttrs : typsig -> attributes
val makeVarinfo : bool -> string -> ?init:init -> typ -> varinfo
val makeFormalVar : fundec -> ?where:string -> string -> typ -> varinfo
val makeLocalVar : fundec -> ?insert:bool -> string -> ?init:init -> typ -> varinfo
val makeTempVar : fundec -> ?insert:bool -> ?name:string -> ?descr:GoblintCil__.Pretty.doc -> ?descrpure:bool -> typ -> varinfo
val makeGlobalVar : string -> typ -> varinfo
val copyVarinfo : varinfo -> string -> varinfo
val newVID : unit -> int
val addOffsetLval : offset -> lval -> lval
val addOffset : offset -> offset -> offset
val removeOffsetLval : lval -> lval * offset
val removeOffset : offset -> offset * offset
val typeOfLval : lval -> typ
val typeOffset : typ -> offset -> typ
val zero : exp
val one : exp
val mone : exp
val kintegerCilint : ikind -> GoblintCil__.Cilint.cilint -> exp
val kinteger64 : ikind -> int64 -> exp
val kinteger : ikind -> int -> exp
val integer : int -> exp
val getInteger : exp -> GoblintCil__.Cilint.cilint option
val i64_to_int : int64 -> int
val cilint_to_int : GoblintCil__.Cilint.cilint -> int
val isConstant : exp -> bool
val isConstantOffset : offset -> bool
val isZero : exp -> bool
val isNullPtrConstant : exp -> bool
val charConstToInt : char -> constant
val constFold : bool -> exp -> exp
val constFoldBinOp : bool -> binop -> exp -> exp -> typ -> exp
val increm : exp -> int -> exp
val var : varinfo -> lval
val mkAddrOf : lval -> exp
val mkAddrOrStartOf : lval -> exp
val mkMem : addr:exp -> off:offset -> lval
val mkString : string -> exp
val mkCastT : e:exp -> oldt:typ -> newt:typ -> exp
val mkCast : e:exp -> newt:typ -> exp
val stripCasts : exp -> exp
val typeOf : exp -> typ
val parseInt : string -> exp
val mkStmt : stmtkind -> stmt
val mkBlock : stmt list -> block
val mkStmtOneInstr : instr -> stmt
val compactStmts : stmt list -> stmt list
val mkEmptyStmt : unit -> stmt
val dummyInstr : instr
val dummyStmt : stmt
val mkWhile : guard:exp -> body:stmt list -> stmt list
val mkForIncr : iter:varinfo -> first:exp -> stopat:exp -> incr:exp -> body:stmt list -> stmt list
val mkFor : start:stmt list -> guard:exp -> next:stmt list -> body:stmt list -> stmt list
type attributeClass = GoblintCil__Cil.attributeClass =
  1. | AttrName
  2. | AttrFunType
  3. | AttrType
val attributeHash : (string, attributeClass) Hashtbl.t
val partitionAttributes : default:attributeClass -> attributes -> attribute list * attribute list * attribute list
val addAttribute : attribute -> attributes -> attributes
val addAttributes : attribute list -> attributes -> attributes
val dropAttribute : string -> attributes -> attributes
val dropAttributes : string list -> attributes -> attributes
val filterAttributes : string -> attributes -> attributes
val hasAttribute : string -> attributes -> bool
val typeAttrs : typ -> attribute list
val typeAttrsOuter : typ -> attribute list
val setTypeAttrs : typ -> attributes -> typ
val typeAddAttributes : attribute list -> typ -> typ
val typeRemoveAttributes : string list -> typ -> typ
val partitionQualifierAttributes : attribute list -> attribute list * attribute list
val removeOuterQualifierAttributes : typ -> typ
val expToAttrParam : exp -> attrparam
exception NotAnAttrParam of exp
type !'a visitAction = 'a GoblintCil__Cil.visitAction =
  1. | SkipChildren
  2. | DoChildren
  3. | ChangeTo of 'a
  4. | ChangeDoChildrenPost of 'a * 'a -> 'a
class type cilVisitor = object ... end
val visitCilFile : cilVisitor -> file -> unit
val visitCilFileSameGlobals : cilVisitor -> file -> unit
val visitCilGlobal : cilVisitor -> global -> global list
val visitCilFunction : cilVisitor -> fundec -> fundec
val visitCilExpr : cilVisitor -> exp -> exp
val visitCilLval : cilVisitor -> lval -> lval
val visitCilOffset : cilVisitor -> offset -> offset
val visitCilInitOffset : cilVisitor -> offset -> offset
val visitCilInstr : cilVisitor -> instr -> instr list
val visitCilStmt : cilVisitor -> stmt -> stmt
val visitCilBlock : cilVisitor -> block -> block
val visitCilType : cilVisitor -> typ -> typ
val visitCilVarDecl : cilVisitor -> varinfo -> varinfo
val visitCilInit : cilVisitor -> varinfo -> offset -> init -> init
val visitCilAttributes : cilVisitor -> attribute list -> attribute list
val msvcMode : bool ref
val makeStaticGlobal : bool ref
val useLogicalOperators : bool ref
val useComputedGoto : bool ref
val useCaseRange : bool ref
val caseRangeFold : label list -> label list
val oldstyleExternInline : bool ref
val constFoldVisitor : bool -> cilVisitor
type lineDirectiveStyle = GoblintCil__Cil.lineDirectiveStyle =
  1. | LineComment
  2. | LineCommentSparse
  3. | LinePreprocessorInput
  4. | LinePreprocessorOutput
val lineDirectiveStyle : lineDirectiveStyle option ref
val print_CIL_Input : bool ref
val printCilAsIs : bool ref
val lineLength : int ref
val forgcc : string -> string
val currentLoc : location ref
val currentExpLoc : location ref
val currentGlobal : global ref
val d_loc : unit -> location -> GoblintCil__.Pretty.doc
val d_thisloc : unit -> GoblintCil__.Pretty.doc
val d_ikind : unit -> ikind -> GoblintCil__.Pretty.doc
val d_fkind : unit -> fkind -> GoblintCil__.Pretty.doc
val d_storage : unit -> storage -> GoblintCil__.Pretty.doc
val d_const : unit -> constant -> GoblintCil__.Pretty.doc
val derefStarLevel : int
val indexLevel : int
val arrowLevel : int
val addrOfLevel : int
val additiveLevel : int
val comparativeLevel : int
val bitwiseLevel : int
val getParenthLevel : exp -> int
class type cilPrinter = object ... end
val defaultCilPrinter : cilPrinter
val plainCilPrinter : cilPrinter
class type descriptiveCilPrinter = object ... end
val descriptiveCilPrinter : descriptiveCilPrinter
val printerForMaincil : cilPrinter ref
val printType : cilPrinter -> unit -> typ -> GoblintCil__.Pretty.doc
val printExp : cilPrinter -> unit -> exp -> GoblintCil__.Pretty.doc
val printLval : cilPrinter -> unit -> lval -> GoblintCil__.Pretty.doc
val printGlobal : cilPrinter -> unit -> global -> GoblintCil__.Pretty.doc
val printAttr : cilPrinter -> unit -> attribute -> GoblintCil__.Pretty.doc
val printAttrs : cilPrinter -> unit -> attributes -> GoblintCil__.Pretty.doc
val printInstr : cilPrinter -> unit -> instr -> GoblintCil__.Pretty.doc
val printStmt : cilPrinter -> unit -> stmt -> GoblintCil__.Pretty.doc
val printBlock : cilPrinter -> unit -> block -> GoblintCil__.Pretty.doc
val dumpStmt : cilPrinter -> out_channel -> int -> stmt -> unit
val dumpBlock : cilPrinter -> out_channel -> int -> block -> unit
val printInit : cilPrinter -> unit -> init -> GoblintCil__.Pretty.doc
val dumpInit : cilPrinter -> out_channel -> int -> init -> unit
val d_type : unit -> typ -> GoblintCil__.Pretty.doc
val d_exp : unit -> exp -> GoblintCil__.Pretty.doc
val d_lval : unit -> lval -> GoblintCil__.Pretty.doc
val d_offset : GoblintCil__.Pretty.doc -> unit -> offset -> GoblintCil__.Pretty.doc
val d_init : unit -> init -> GoblintCil__.Pretty.doc
val d_binop : unit -> binop -> GoblintCil__.Pretty.doc
val d_unop : unit -> unop -> GoblintCil__.Pretty.doc
val d_attr : unit -> attribute -> GoblintCil__.Pretty.doc
val d_attrparam : unit -> attrparam -> GoblintCil__.Pretty.doc
val d_attrlist : unit -> attributes -> GoblintCil__.Pretty.doc
val d_instr : unit -> instr -> GoblintCil__.Pretty.doc
val d_label : unit -> label -> GoblintCil__.Pretty.doc
val d_stmt : unit -> stmt -> GoblintCil__.Pretty.doc
val d_block : unit -> block -> GoblintCil__.Pretty.doc
val d_global : unit -> global -> GoblintCil__.Pretty.doc
val dn_exp : unit -> exp -> GoblintCil__.Pretty.doc
val dn_lval : unit -> lval -> GoblintCil__.Pretty.doc
val dn_init : unit -> init -> GoblintCil__.Pretty.doc
val dn_type : unit -> typ -> GoblintCil__.Pretty.doc
val dn_global : unit -> global -> GoblintCil__.Pretty.doc
val dn_attrlist : unit -> attributes -> GoblintCil__.Pretty.doc
val dn_attr : unit -> attribute -> GoblintCil__.Pretty.doc
val dn_attrparam : unit -> attrparam -> GoblintCil__.Pretty.doc
val dn_stmt : unit -> stmt -> GoblintCil__.Pretty.doc
val dn_instr : unit -> instr -> GoblintCil__.Pretty.doc
val d_shortglobal : unit -> global -> GoblintCil__.Pretty.doc
val dumpGlobal : cilPrinter -> out_channel -> global -> unit
val dumpFile : cilPrinter -> out_channel -> string -> file -> unit
val bug : ('a, unit, GoblintCil__.Pretty.doc) format -> 'a
val unimp : ('a, unit, GoblintCil__.Pretty.doc) format -> 'a
val error : ('a, unit, GoblintCil__.Pretty.doc) format -> 'a
val errorLoc : location -> ('a, unit, GoblintCil__.Pretty.doc) format -> 'a
val warn : ('a, unit, GoblintCil__.Pretty.doc) format -> 'a
val warnOpt : ('a, unit, GoblintCil__.Pretty.doc) format -> 'a
val warnContext : ('a, unit, GoblintCil__.Pretty.doc) format -> 'a
val warnContextOpt : ('a, unit, GoblintCil__.Pretty.doc) format -> 'a
val warnLoc : location -> ('a, unit, GoblintCil__.Pretty.doc) format -> 'a
val d_plainexp : unit -> exp -> GoblintCil__.Pretty.doc
val d_plaininit : unit -> init -> GoblintCil__.Pretty.doc
val d_plainlval : unit -> lval -> GoblintCil__.Pretty.doc
val d_plaintype : unit -> typ -> GoblintCil__.Pretty.doc
val dd_exp : unit -> exp -> GoblintCil__.Pretty.doc
val dd_lval : unit -> lval -> GoblintCil__.Pretty.doc
val uniqueVarNames : file -> unit
val peepHole2 : ((instr * instr) -> instr list option) -> stmt list -> unit
val peepHole1 : (instr -> instr list option) -> stmt list -> unit
exception SizeOfError of string * typ
val unsignedVersionOf : ikind -> ikind
val signedVersionOf : ikind -> ikind
val intRank : ikind -> int
val commonIntKind : ikind -> ikind -> ikind
val intKindForSize : int -> bool -> ikind
val floatKindForSize : int -> fkind
val bytesSizeOfInt : ikind -> int
val bitsSizeOf : typ -> int
val truncateCilint : ikind -> GoblintCil__.Cilint.cilint -> GoblintCil__.Cilint.cilint * GoblintCil__.Cilint.truncation
val fitsInInt : ikind -> GoblintCil__.Cilint.cilint -> bool
val intKindForValue : GoblintCil__.Cilint.cilint -> bool -> ikind
val mkCilint : ikind -> int64 -> GoblintCil__.Cilint.cilint
val mkCilintIk : ikind -> GoblintCil__.Cilint.cilint -> GoblintCil__.Cilint.cilint
val const_if_not_overflow : exp -> ikind -> GoblintCil__.Cilint.cilint -> exp
val sizeOf : typ -> exp
val alignOf_int : typ -> int
val bitsOffset : typ -> offset -> int * int
val char_is_unsigned : bool ref
val little_endian : bool ref
val underscore_name : bool ref
val locUnknown : location
val get_instrLoc : instr -> location
val get_globalLoc : global -> location
val get_stmtLoc : stmtkind -> location
val dExp : GoblintCil__.Pretty.doc -> exp
val dInstr : GoblintCil__.Pretty.doc -> location -> instr
val dGlobal : GoblintCil__.Pretty.doc -> location -> global
val mapNoCopy : ('a -> 'a) -> 'a list -> 'a list
val mapNoCopyList : ('a -> 'a list) -> 'a list -> 'a list
val startsWith : string -> string -> bool
val endsWith : string -> string -> bool
val stripUnderscores : string -> string
val freshLabel : string -> string
val populateLabelAlphaTable : fundec -> unit
type formatArg = GoblintCil__Cil.formatArg =
  1. | Fe of exp
  2. | Feo of exp option
  3. | Fu of unop
  4. | Fb of binop
  5. | Fk of ikind
  6. | FE of exp list
  7. | Ff of string * typ * attributes
  8. | FF of (string * typ * attributes) list
  9. | Fva of bool
  10. | Fv of varinfo
  11. | Fl of lval
  12. | Flo of lval option
  13. | Fo of offset
  14. | Fc of compinfo
  15. | Fi of instr
  16. | FI of instr list
  17. | Ft of typ
  18. | Fd of int
  19. | Fg of string
  20. | Fs of stmt
  21. | FS of stmt list
  22. | FA of attributes
  23. | Fp of attrparam
  24. | FP of attrparam list
  25. | FX of string
val d_formatarg : unit -> formatArg -> GoblintCil__.Pretty.doc
val warnTruncate : bool ref
val envMachine : GoblintCil__.Machdep.mach option ref
val gccBuiltins : (string, typ * typ list * bool) Hashtbl.t
module Cfg : sig ... end
module Check : sig ... end
module Cil : sig ... end
module Cilint : sig ... end
module Cillower : sig ... end
module Ciltools : sig ... end
module Cilutil : sig ... end
module Dataflow : sig ... end
module Dominators : sig ... end
module Escape : sig ... end
module Expcompare : sig ... end
module Feature : sig ... end
module Formatcil : sig ... end
module Machdep : sig ... end
module Machdepenv : sig ... end
module Mergecil : sig ... end
module Rmtmps : sig ... end
module Cabs : sig ... end
module Cabs2cil : sig ... end
module Cabshelper : sig ... end
module Cabsvisit : sig ... end
module Cprint : sig ... end
module Frontc : sig ... end
module Patch : sig ... end
module Whitetrack : sig ... end
module Alpha : sig ... end
module Errormsg : sig ... end
module GrowArray : sig ... end
module Inthash : sig ... end
module Pretty : sig ... end
module Stats : sig ... end
module Trace : sig ... end
module Util : sig ... end
Sourceval d_varinfo : unit -> varinfo -> GoblintCil__.Pretty.doc
include module type of struct include Pretty end
type doc = GoblintCil__Pretty.doc
val nil : doc
val (++) : doc -> doc -> doc
val concat : doc -> doc -> doc
val text : string -> doc
val num : int -> doc
val num64 : int64 -> doc
val real : float -> doc
val chr : char -> doc
val line : doc
val leftflush : doc
val break : doc
val align : doc
val unalign : doc
val mark : doc
val unmark : doc
val indent : int -> doc -> doc
val markup : doc -> doc
val seq : sep:doc -> doit:('a -> doc) -> elements:'a list -> doc
val docList : ?sep:doc -> ('a -> doc) -> unit -> 'a list -> doc
val d_list : string -> (unit -> 'a -> doc) -> unit -> 'a list -> doc
val docArray : ?sep:doc -> (int -> 'a -> doc) -> unit -> 'a array -> doc
val docOpt : ('a -> doc) -> unit -> 'a option -> doc
val d_int32 : int32 -> doc
val f_int32 : unit -> int32 -> doc
val d_int64 : int64 -> doc
val f_int64 : unit -> int64 -> doc
module MakeMapPrinter : sig ... end
module MakeSetPrinter : sig ... end
val insert : unit -> doc -> doc
val dprintf : ('a, unit, doc, doc) format4 -> 'a
val gprintf : (doc -> 'b) -> ('a, unit, doc, 'b) format4 -> 'a
val fprint : out_channel -> width:int -> doc -> unit
val fprintf : out_channel -> ('a, unit, doc) format -> 'a
val printf : ('a, unit, doc) format -> 'a
val eprintf : ('a, unit, doc) format -> 'a
val withPrintDepth : int -> (unit -> unit) -> unit
val printDepth : int ref
val printIndent : bool ref
val fastMode : bool ref
val flushOften : bool ref
val flattenBeforePrint : bool ref
val countNewLines : int ref
val auto_printer : string -> 'b
Sourceval sprint : (unit -> 'a -> Pretty.doc) -> 'a -> string
OCaml

Innovation. Community. Security.