package bogue

  1. Overview
  2. Docs

Utilities

This module contains several utilities, in particular for debug logs.

Dependency graph

Debugging

val printd : int -> ('a, unit, string, unit) format4 -> 'a

For instance printd debug_warning "The value x=%u is too big" x will print a message in the console only if the debug variable contains the debug_warning flag.

val debug : bool ref
val debug_code : int ref

Logical ored of !debug with debug flags (below) controls the amount of debuging.

Binary masks (=flags) for debugging messages.

val debug_thread : int
val debug_warning : int
val debug_graphics : int
val debug_error : int
val debug_io : int
val debug_memory : int
val debug_board : int
val debug_event : int
val debug_custom : int

Maths

val pi : float
val round : float -> int

Round float to nearest integer.

val imax : int -> int -> int

imax a b returns max(a,b)

val imin : int -> int -> int

Tsdl Result

val go : ('a, 'b) result -> 'a

Transform a result into a standard value, or fail with an error. Used only for SDL functions.

Options

Monadic style operations on optional variables.

val map_option : 'a option -> ('a -> 'b) -> 'b option
val do_option : 'a option -> ('a -> unit) -> unit
val default : 'a option -> 'a -> 'a
exception None_option
val remove_option : 'a option -> 'a

Warning: remove_option None will raise the None_option exception.

Others

val run : (unit -> 'a) -> 'a

run f is equivalent to f ().

OCaml

Innovation. Community. Security.