Module Flx_cil_util


module Flx_cil_util: sig .. end
A bunch of generally useful functions

exception GotSignal of int
val withTimeout : float -> (int -> 'a) -> ('b -> 'a) -> 'b -> 'a
val docHash : ('a -> 'b -> Flx_cil_pretty.doc) ->
unit -> ('a, 'b) Hashtbl.t -> Flx_cil_pretty.doc
val hash_to_list : ('a, 'b) Hashtbl.t -> ('a * 'b) list
val keys : ('a, 'b) Hashtbl.t -> 'a list
val hash_copy_into : ('a, 'b) Hashtbl.t -> ('a, 'b) Hashtbl.t -> unit
Copy a hash table into another

First, a few utility functions I wish were in the standard prelude
val anticompare : 'a -> 'a -> int
val list_drop : int -> 'a list -> 'a list
val list_span : ('a -> bool) -> 'a list -> 'a list * 'a list
val list_insert_by : ('a -> 'a -> int) -> 'a -> 'a list -> 'a list
val list_head_default : 'a -> 'a list -> 'a
val list_iter3 : ('a -> 'b -> 'c -> unit) -> 'a list -> 'b list -> 'c list -> unit
val get_some_option_list : 'a option list -> 'a list
val list_iteri : (int -> 'a -> unit) -> 'a list -> unit
Iterate over a list passing the index as you go
val list_mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
val list_fold_lefti : ('a -> int -> 'b -> 'a) -> 'a -> 'b list -> 'a
Like fold_left but pass the index into the list as well
val int_range_list : int -> int -> int list
val list_init : int -> (int -> 'a) -> 'a list

mapNoCopy is like map but avoid copying the list if the function does not * change the elements
val mapNoCopy : ('a -> 'a) -> 'a list -> 'a list
val mapNoCopyList : ('a -> 'a list) -> 'a list -> 'a list
val filterNoCopy : ('a -> bool) -> 'a list -> 'a list

type 'a growArrayFill =
| Elem of 'a
| Susp of (int -> 'a)
Growable arrays

type 'a growArray = {
   gaFill : 'a growArrayFill; (*Stuff to use to fill in the array as it grows*)
   mutable gaMaxInitIndex : int; (*Maximum index that was written to. -1 if no writes have * been made.*)
   mutable gaData : 'a array;
}
val newGrowArray : int -> 'a growArrayFill -> 'a growArray
newGrowArray initsz fillhow
val getReg : 'a growArray -> int -> 'a
val setReg : 'a growArray -> int -> 'a -> unit
val copyGrowArray : 'a growArray -> 'a growArray
val deepCopyGrowArray : 'a growArray -> ('a -> 'a) -> 'a growArray
val growArray_iteri : (int -> 'a -> unit) -> 'a growArray -> unit
Iterate over the initialized elements of the array
val growArray_foldl : ('a -> 'b -> 'a) -> 'a -> 'b growArray -> 'a
Fold left over the initialized elements of the array
val hasPrefix : string -> string -> bool
hasPrefix prefix str returns true with str starts with prefix
val restoreRef : ?deepCopy:('a -> 'a) -> 'a Pervasives.ref -> unit -> unit
Given a ref cell, produce a thunk that later restores it to its current value
val restoreHash : ?deepCopy:('a -> 'a) -> ('b, 'a) Hashtbl.t -> unit -> unit
Given a hash table, produce a thunk that later restores it to its current value
val restoreArray : ?deepCopy:('a -> 'a) -> 'a array -> unit -> unit
Given an array, produce a thunk that later restores it to its current value
val runThunks : (unit -> unit) list -> unit -> unit
Given a list of thunks, produce a thunk that runs them all
val memoize : ('a, 'b) Hashtbl.t -> 'a -> ('a -> 'b) -> 'b
val findOrAdd : ('a, 'b) Hashtbl.t -> 'a -> ('a -> 'b) -> 'b
Just another name for memoize
val tryFinally : ('a -> 'b) -> ('b option -> unit) -> 'a -> 'b

type registerInfo = {
   rName : string; (*The name of the register*)
   rGroup : string; (*The name of the group to which this register belongs. * The special group Engine.machineRegisterGroup * contains the machine registers, which are displayed in * a special window.*)
   rVal : Flx_cil_pretty.doc; (*The value to be displayed about a register*)
   rOneLineVal : Flx_cil_pretty.doc option; (*The value to be displayed on one line*)
}
The state information that the UI must display is viewed abstractly as a * set of registers.
val valOf : 'a option -> 'a
Get the value of an option. Raises Failure if None
val fold_for : init:'a -> lo:int -> hi:int -> (int -> 'a -> 'a) -> 'a
* An accumulating for loop. * * Initialize the accumulator with init. The current index and accumulator * from the previous iteration is passed to f.
module type STACK = sig .. end
module Stack: STACK 

type configData =
| ConfInt of int
| ConfBool of bool
| ConfFloat of float
| ConfString of string
| ConfList of configData list
The configuration data can be of several types *
val loadConfiguration : string -> unit
Load the configuration from a file
val saveConfiguration : string -> unit
Save the configuration in a file. Overwrites the previous values
val clearConfiguration : unit -> unit
Clear all configuration data
val setConfiguration : string -> configData -> unit
Set a configuration element, with a key. Overwrites the previous values
val findConfiguration : string -> configData
Find a configuration elements, given a key. Raises Not_found if it canont * find it
val findConfigurationInt : string -> int
Like findConfiguration but extracts the integer
val useConfigurationInt : string -> (int -> unit) -> unit
Looks for an integer configuration element, and if it is found, it uses * the given function. Otherwise, does nothing
val findConfigurationBool : string -> bool
val useConfigurationBool : string -> (bool -> unit) -> unit
val findConfigurationString : string -> string
val useConfigurationString : string -> (string -> unit) -> unit
val findConfigurationList : string -> configData list
val useConfigurationList : string -> (configData list -> unit) -> unit
type symbol = int 
Symbols are integers that are uniquely associated with names
val symbolName : symbol -> string
Get the name of a symbol
val registerSymbolName : string -> symbol
Register a symbol name and get the symbol for it
val registerSymbolRange : int -> (int -> string) -> symbol
Register a number of consecutive symbol ids. The naming function will be * invoked with indices from 0 to the counter - 1. Returns the id of the * first symbol created