text
stringlengths
0
601k
let linux_lvm2_pvgroup_logical_volumes proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVGroupLogicalVolumes proxy
let linux_lvm2_lvname proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2LVName proxy
let linux_lvm2_lvuuid proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2LVUuid proxy
let linux_lvm2_lvgroup_name proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2LVGroupName proxy
let linux_lvm2_lvgroup_uuid proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2LVGroupUuid proxy
let linux_dmmp_component_holder proxy = OBus_property . map_r_with_context ( fun context x -> OBus_proxy . make ( OBus_context . sender context ) x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxDmmpComponentHolder proxy )
let linux_dmmp_name proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxDmmpName proxy
let linux_dmmp_slaves proxy = OBus_property . map_r_with_context ( fun context x -> List . map ( fun path -> OBus_proxy . make ( OBus_context . sender context ) path ) x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxDmmpSlaves proxy )
let linux_dmmp_parameters proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxDmmpParameters proxy
let linux_loop_filename proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLoopFilename proxy
let properties proxy = OBus_property . group ~ monitor : UDisks_monitor . monitor proxy interface
module type S = sig module M : Monads . State_sig type key = int val add : key -> unit M . t val find : key -> key M . t val union : key -> key -> key M . t val show : string M . t end
module UF : S = struct type node = T of { rank : int } | Ptr of key and key = int module S = Stores . Map ( Int_map ) ( struct type key = int type value = node let key_to_string = string_of_int let value_to_string ( x : value ) = match x with | T { rank } -> Printf . sprintf " [ % d ] " rank | Ptr k -> Printf . sprintf...
module type Str_conv_sig = sig module type UintSig = sig type t val name : string val fmt : string val zero : t val max_int : t val bits : int val of_int : int -> t val to_int : t -> int val add : t -> t -> t val mul : t -> t -> t val divmod : t -> t -> t * t end module type S = sig type t val of_string : string -> t v...
module Str_conv : Str_conv_sig = struct module type UintSig = sig type t val name : string val fmt : string val zero : t val max_int : t val bits : int val of_int : int -> t val to_int : t -> int val add : t -> t -> t val mul : t -> t -> t val divmod : t -> t -> t * t end module type S = sig type t val of_string : stri...
module Conv = Uint . Str_conv . Make ( struct type t = uint16 let fmt = " Ul " let name = " Uint16 " let zero = zero let max_int = max_int let bits = 16 let of_int = of_int let to_int = to_int let add = add let mul = mul let divmod = ( fun x y -> div x y , rem x y ) end )
module Conv = Uint . Str_conv . Make ( struct type t = uint32 let fmt = " Ul " let name = " Uint32 " let zero = zero let max_int = max_int let bits = 32 let of_int = of_int let to_int = to_int let add = add let mul = mul let divmod = ( fun x y -> div x y , rem x y ) end )
module Conv = Uint . Str_conv . Make ( struct type t = uint64 let name = " Uint64 " let fmt = " UL " let zero = zero let max_int = max_int let bits = 64 let of_int = of_int let to_int = to_int let add = add let mul = mul let divmod = ( fun x y -> div x y , rem x y ) end )
let to_signed c = let c = Char . code c in if ( c > 127 ) then ( ( - lnot c + 1 ) land 255 ) else c
let zero = Char . unsafe_chr 0
let one = Char . unsafe_chr 1
let add x y = ( code x + code y ) land max_int |> chr
let sub x y = ( code x - code y ) land max_int |> chr
let mul x y = ( code x * code y ) land max_int |> chr
let div x y = code x / code y |> chr
let rem x y = code x mod code y |> chr
let pred x = sub x one
let succ x = add x one
module Infix = struct let ( * ) = mul let ( + ) = add let ( - ) = sub let ( / ) = div let ( mod ) = rem end
let ( lsl ) x y = ( code x lsl code y ) land max_int |> chr
let ( lsr ) x y = code x lsr code y |> chr
let ( land ) x y = code x land code y |> chr
let ( lor ) x y = code x lor code y |> chr
let ( lxor ) x y = code x lxor code y |> chr
let lnot x = x lxor ( Char . chr max_int )
let swap_nibbles x = ( ( x land ( chr 0x0f ) ) lsl chr 4 ) lor ( ( x land ( Char . chr 0xF0 ) ) lsr ( chr 4 ) )
let is_bit_set x bit = x land ( one lsl ( Char . unsafe_chr bit ) ) != zero
let is_bit_set ' bit x = is_bit_set x bit
let set_bit x bit = x lor ( one lsl ( Char . unsafe_chr bit ) )
let set_bit ' bit x = x lor ( one lsl ( Char . unsafe_chr bit ) )
let unset_bit x bit = x land ( lnot ( one lsl ( Char . unsafe_chr bit ) ) )
let unset_bit ' bit x = x land ( lnot ( one lsl ( Char . unsafe_chr bit ) ) )
let toggle_bit x bit = x lxor ( one lsl ( Char . unsafe_chr bit ) )
let show_hex x = Printf . sprintf " 0x % 02X " ( code x )
let show_hex ' x = Printf . sprintf " % 02X " ( code x )
let show_bin d = if d = zero then " 0 " else let rec aux acc d = if d = zero then acc else aux ( string_of_int ( code ( d land one ) ) :: acc ) ( d lsr one ) in String . concat " " ( aux [ ] d )
let get_n_bits x n = ( x lsl n ) lsr n
module MakeInfix ( B : Uints_intf . Basics ) : Uints_intf . Infix with type t := B . t = struct open B let ( + ) = add let ( - ) = sub let ( * ) = mul let ( / ) = div let ( = ) = equal let ( <> ) = ( fun a b -> not ( equal a b ) ) let ( <= ) = le let ( mod ) = rem let ( land ) = logand let ( lor ) = logor let ( lxor ) ...
module Uint8 = struct module B = struct type t = int let max_int = 0xFF let zero = 0 let one = 1 let compare = Int . compare let equal x y = compare x y = 0 let le x y = ( x <= y ) let add x y = ( x + y ) land max_int let sub x y = ( x - y ) land max_int let mul x y = ( x * y ) land max_int let div x y = ( x / y ) land...
module Uint16 = struct module B = struct type t = int let max_int = 0xFFFF let zero = 0 let one = 1 let compare = Int . compare let equal x y = compare x y = 0 let le x y = ( x <= y ) let add x y = ( x + y ) land max_int let sub x y = ( x - y ) land max_int let mul x y = ( x * y ) land max_int let div x y = ( x / y ) l...
module Int8 = struct type t = int let of_byte b = b let of_int x = if x < 0 then ( x land 0xFF ) lor 0b10000000 else ( x land 0xFF ) let is_neg t = t land ( 1 lsl 7 ) <> 0 let abs t = if is_neg t then ( t - 1 ) lxor 0b11111111 else t let to_int t = if is_neg t then ( - abs t ) else t let show t = if t land ( 1 lsl 7 ) ...
module type Basics = sig type t val show : t -> string val max_int : t val zero : t val one : t val compare : t -> t -> int val equal : t -> t -> bool val le : t -> t -> bool val add : t -> t -> t val sub : t -> t -> t val mul : t -> t -> t val div : t -> t -> t val rem : t -> t -> t val succ : t -> t val pred : t -> t...
module type Infix = sig type t val ( + ) : t -> t -> t val ( - ) : t -> t -> t val ( * ) : t -> t -> t val ( / ) : t -> t -> t val ( = ) : t -> t -> bool val ( <> ) : t -> t -> bool val ( <= ) : t -> t -> bool val ( mod ) : t -> t -> t val ( land ) : t -> t -> t val ( lor ) : t -> t -> t val ( lxor ) : t -> t -> t val ...
module type S = sig type t include Basics with type t := t module Infix : Infix with type t := t include Infix with type t := t end
let toggle_element ( projection : Api_types_j . simulation_info option -> bool ) ( content : [ < Html_types . div_content_fun ] Html . elt Html . list_wrap ) = Html . div ~ a [ : Tyxml_js . R . Html . a_class ( React . S . bind State_simulation . model ( fun model -> React . S . const ( if projection ( State_simulation...
let option_label label = if String . length label > 10 then ( String . sub label 0 7 ) " . . . " ^ else label
let export_controls ( ~ export_select_id : string ) ( ~ export_filename_id : string ) ( ~ export_button_id : string ) ( ~ export_data_label : string ) = let export_formats : string list = [ export_data_label ] in let export_filename = Html . input ~ a [ : Html . a_id export_filename_id ; Html . a_input_type ` Text ; Ht...
let label_news tab_is_active counter = let count = React . S . map ( fun model -> let simulation_info = State_simulation . t_simulation_info model in counter simulation_info ) State_simulation . model in let bip = ref React . E . never in let labels , set_labels = ReactiveData . RList . create [ ] in let _ = React . S ...
let badge ( counter : Api_types_j . simulation_info option -> int ) = let badge , badge_handle = ReactiveData . RList . create [ ] in let _ = React . S . map ( fun model -> let simulation_info = State_simulation . t_simulation_info model in let count = counter simulation_info in if count > 0 then ReactiveData . RList ....
let arguments ( key : string ) : string list = List . map snd ( List . filter ( fun ( k , _ ) -> key = k ) Url . Current . arguments )
let version ( ? test ' : a option = None ) ( ~ prod ' : a ) ( ~ dev ' : a ) ' : a = let version : string list = arguments " version " in match ( test , version ) with | ( Some test , [ " test " ] ) -> test | ( _ , [ " dev " ] ) -> dev | _ -> prod
let navli label force_class decorations = let default_attributes = [ Html . a_id ( " nav " ^ label ) ; Html . a_role [ " presentation " ] ] in let attributes = match force_class with | None -> default_attributes | Some l -> ( Tyxml_js . R . Html5 . a_class l ) :: default_attributes in let text = ReactiveData . RList . ...
let navtabs nav_tab_id = function | [ ] | ( _ , Some _ , _ ) :: _ -> Common . toss " ui_common . navtabs : missing tabs " | ( ti , None , l ) :: t -> Html . ul ~ a [ : Html . a_id nav_tab_id ; Html . a_class [ " nav " ; " nav - tabs " ] ; Html . Unsafe . string_attrib " role " " tablist " ] ( navli ti ( Some ( React . ...
let onenavcontent label active classes content = Html . div ~ a [ : Html . a_id label ; Html . a_class ( if active then " flex - content " :: " tab - pane " :: " active " :: classes else " flex - content " :: " tab - pane " :: classes ) ; Html . Unsafe . string_attrib " role " " tabpanel " ] content
let navcontent ? id classes = function | [ ] -> Common . toss " ui_common . navcontent : missing content " | ( t , cl , c ) :: l -> let id : [ > ` Id ] Html . attrib list = match id with | None -> [ ] | Some id -> [ Html . a_id id ] in Html . div ~ a ( [ : Html . a_class ( [ " panel - content " ; " tab - content " ; " ...
let level ? debug ? info ? notice ? warning ? error ? fatal ( ) : ' a list = let level : string list = arguments " level " in let extract key value = match value with | None -> [ ] | Some value -> if List . mem key level then [ value ] else [ ] in ( extract " debug " debug ) @ ( extract " info " info ) @ ( extract " no...
let features ( ? default [ ] ) = ( options ( : string * ' a ) list ) : ' a list = let features : string list = arguments " feature " in let matches : ' a list = List . map snd ( List . filter ( fun ( feature , _ ) -> List . mem feature features ) options ) in match matches with | [ ] -> default | _ :: _ -> matches
let input_change input_dom signal_handler = input_dom . ## onchange := Dom_html . handler ( fun _ -> let ( ) = signal_handler ( Js . to_string ( input_dom . ## value ) ) in Js . _true )
module type Menu = sig val content : unit -> [ > ` Button | ` Div | ` Ul | ` A of [ > ` PCDATA | ` Span ] ] Tyxml_js . Html5 . elt list val onload : unit -> unit end ; ;
module type Div = sig val id : string val content : unit -> Html_types . div_content_fun Tyxml_js . Html . elt list val onload : unit -> unit end ; ;
module type Tab = sig val navli : unit -> Html_types . flow5_without_interactive Tyxml_js . Html5 . elt ReactiveData . RList . t val content : unit -> Html_types . div_content_fun Tyxml_js . Html5 . elt list val onload : unit -> unit val onresize : unit -> unit end ; ;
module type SubTab = sig include Tab val parent_hide : unit -> unit val parent_shown : unit -> unit end
module type Panel = sig val content : unit -> Html_types . div Tyxml_js . Html5 . elt val onload : unit -> unit val onresize : unit -> unit end ; ;
let id_dom ( id : string ) : ' a Js . t = Js . Unsafe . coerce ( ( Js . Opt . get ( document ## getElementById ( Js . string id ) ) ( fun ( ) -> Common . toss ( Format . sprintf " ui_common . id_dom : could not find id % s " id ) ) ) : Dom_html . element Js . t )
let create_modal ( ~ id : string ) ( ~ title_label : string ) ( ~ body : [ < Html_types . div_content_fun ] Html . elt Html . list_wrap ) ( ~ submit_label : string ) ( ~ submit : ( ' self Js . t , _ Js . t ) Dom . event_listener ) : [ > Html_types . div ] Html . elt = let button = Html . button ~ a [ : Html . a_button_...
type token = | DEF | EXTERN | PLUS | MINUS | MUL | DIV | LPAREN | RPAREN | SEMI | COMMA | EOF | NUMBER of float | KWD of char | IDENT of string
let regexp newline = ( ' \ 010 ' | ' \ 013 ' | " \ 013 \ 010 ) "
let regexp blank = [ ' ' ' \ 009 ' ' \ 012 ' ] 012 '
let regexp blanks = blank +
let regexp lowercase = [ ' a ' - ' z ' ' \ 223 ' - ' \ 246 ' ' \ 248 ' - ' \ 255 ' ' _ ' ] ' _ '
let regexp uppercase = [ ' A ' - ' Z ' ' \ 192 ' - ' \ 214 ' ' \ 216 ' - ' \ 222 ' ] 222 '
let regexp whitespace = ( blank | newline ) newline
let regexp underscore = " _ "
let regexp tilde = " " ~
let regexp identchar = [ ' A ' - ' Z ' ' a ' - ' z ' ' _ ' ' \ 192 ' - ' \ 214 ' ' \ 216 ' - ' \ 246 ' ' \ 248 ' - ' \ 255 ' ' \ ' ' ' 0 ' - ' 9 ' ] ' 9 '
let regexp symbolchar = [ ' ! ' ' $ ' ' % ' ' & ' ' * ' ' + ' ' - ' ' . ' ' / ' ' : ' ' < ' ' = ' ' > ' ' ? ' ' @ ' ' ^ ' ' | ' ' ~ ' ] '
let regexp lident = lowercase identchar *
let regexp uidnet = uppercase identchar *
let regexp decimal_literal = [ ' 0 ' - ' 9 ' ] ' 9 ' [ ' 0 ' - ' 9 ' ' _ ' ] ' _ ' *
let regexp hex_literal = ' 0 ' [ ' x ' ' X ' ] ' X ' [ ' 0 ' - ' 9 ' ' A ' - ' F ' ' a ' - ' f ' ] ' f ' [ ' f ' ' 0 ' - ' 9 ' ' A ' - ' F ' ' a ' - ' f ' ' _ ' ] ' _ ' *
let regexp oct_literal = ' 0 ' [ ' o ' ' O ' ] ' O ' [ ' 0 ' - ' 7 ' ] ' 7 ' [ ' 0 ' - ' 7 ' ' _ ' ] ' _ ' *
let regexp bin_literal = ' 0 ' [ ' b ' ' B ' ] ' B ' [ ' 0 ' - ' 1 ' ] ' 1 ' [ ' 0 ' - ' 1 ' ' _ ' ] ' _ ' *
let regexp int_literal = decimal_literal | hex_literal | oct_literal | bin_literal
let regexp float_literal = [ ' 0 ' - ' 9 ' ] ' 9 ' [ ' 0 ' - ' 9 ' ' _ ' ] ' _ ' * ( ' . ' [ ' 0 ' - ' 9 ' ' _ ' ] ' _ ' * ) ? ( [ ' e ' ' E ' ] ' E ' [ ' + ' ' - ' ] ' ? [ ' 0 ' - ' 9 ' ] ' 9 ' [ ' 0 ' - ' 9 ' ' _ ' ] ' _ ' * ) ?
let first = ref true
let rec alex pos = lexer | " ; " -> SEMI | ( " " -> LPAREN | ) " " -> RPAREN | " " + -> PLUS | " " - -> MINUS | " " * -> MUL | " " / -> DIV | " extern " -> EXTERN | " def " -> DEF | " , " -> COMMA | " \ n " -> new_line lexbuf pos ; alex pos lexbuf | float_literal -> ( NUMBER ( ( u8l |- float_of_string ) float_of_string...
let test filename = Legacy ( . let revised_parser = menhir_with_ulex alex main in let chan = open_in filename in let lexbuf = Ulexing . from_utf8_channel chan in handle_ulexing_error revised_parser lexbuf ; close_in chan )
let test_lexer filename = Legacy ( . let chan = open_in filename in let lexbuf = Ulexing . from_utf8_channel chan in let tokens = tokens_of_buf alex lexbuf in Stream . iter ( dump |- print_string |- print_newline ) print_newline tokens )
let _ = test " sample . py "
type separator = [ ` CR | ` LF | ` CRLF | ` NEL | ` LS | ` PS ] let sp = match op with ` CR -> [ UChar . chr_of_uint 0x000d ] 0x000d | ` LF -> [ UChar . chr_of_uint 0x000a ] 0x000a | ` CRLF -> [ UChar . chr_of_uint 0x000d ; UChar . chr_of_uint 0x000a ] 0x000a | ` NEL -> [ UChar . chr_of_uint 0x0085 ] 0x0085 | ` LS -> [...