text stringlengths 0 601k |
|---|
let read_ellipse attrs i = let cx = float_of_string ( List . assoc cx_attr attrs ) in let cy = float_of_string ( List . assoc cy_attr attrs ) in let rx = float_of_string ( List . assoc rx_attr attrs ) in let ry = float_of_string ( List . assoc ry_attr attrs ) in let fill = parse_color ( List . assoc fill_attr attrs ) i... |
let rec group l = match l with | x :: y :: r -> ( x , y ) :: group r | [ ] -> [ ] | _ -> assert false |
let read_polygon attrs i = let points = List . assoc points_attr attrs in let points = group ( List . map float_of_string ( Str . split comma_wsp points ) ) in let fill = parse_color ( List . assoc fill_attr attrs ) in let stroke = parse_color ( List . assoc stroke_attr attrs ) in let e = Polygon ( points , fill , stro... |
let read_text attrs i = let fill = parse_color ( try List . assoc fill_attr attrs with Not_found -> " black " ) in let stroke = parse_color ( try List . assoc stroke_attr attrs with Not_found -> " none " ) in let x = float_of_string ( List . assoc x_attr attrs ) in let y = float_of_string ( List . assoc y_attr attrs ) ... |
let rec read_element nm attrs i = skip_whitespace i ; match Xmlm . input i with | ` El_end -> ( ) | ` Data d -> ( match Xmlm . input i with | ` El_end -> ( ) | _ -> assert false ) | ` El_start ( ( _ , nm ' ) , attrs ' ) -> ( match nm ' with | " path " -> ignore ( read_path attrs ' i ) | " ellipse " -> ignore ( read_ell... |
let _ = let ch = open_in " / tmp / foo . svg " in let i = Xmlm . make_input ( ` Channel ch ) in ( match Xmlm . input i with | ` Dtd ( Some nm ) -> ( ) | _ -> assert false ) ; match Xmlm . input i with | ` El_start ( ( _ , nm ) , attrs ) -> assert ( nm = " svg " ) ; read_element nm attrs i | _ -> assert false |
let l = List . rev ! stack |
let bboxes = ref [ ] |
let intersects ( x1 , y1 , x2 , y2 ) ( x3 , y3 , x4 , y4 ) = x1 <= x4 && y1 <= y4 && x3 <= x2 && y3 <= y4 |
let redraw w range ev = let ctx = Cairo_lablgtk . create w # misc # window in Cairo . save ctx ; if ! bboxes = [ ] then bboxes := List . map ( fun e -> compute_extent ctx e ) l ; Cairo . new_path ctx ; Cairo_lablgtk . region ctx ( GdkEvent . Expose . region ev ) ; let rect = Gdk . Rectangle . create 0 0 0 0 in Gdk . Re... |
let slider_changed ( area : GMisc . drawing_area ) range ( ) = let scale = scale . * ( ( 1 . . / scale ) ** range # adjustment # value ) in area # misc # set_size_request ~ width ( : truncate ( width . * scale ) ) ~ height ( : truncate ( height . * scale ) ) ( ) ; GtkBase . Widget . queue_draw area # as_widget |
let _ = ignore ( GMain . Main . init ( ) ) ; let initial_size = 600 in let w = GWindow . window ( ) in ignore ( w # connect # destroy GMain . quit ) ; let b = GPack . vbox ~ spacing : 6 ~ border_width : 12 ~ packing : w # add ( ) in let f = GBin . scrolled_window ~ packing ( : b # pack ~ expand : true ) ( ) in let area... |
let respond ~ status html = let headers = Cohttp . Header . of_list [ " Content - type " , " text / html " ; " Access - Control - Allow - Origin " , " " * ] in Server . respond_string ~ headers ~ status ~ body ( : Render . html_to_string html ) ( ) |
let query ngrok_mode data qs = let pspec = let open Query . PackageSpec in let split_by_space = String . split & function ' ' -> true | _ -> false in match assoc_opt " packtype " qs , assoc_opt " packs " qs with | ( Some [ " vanilla " ] | None ) , Some [ s ] -> Vanilla ( split_by_space s ) | Some [ " just " ] , Some [ ... |
let style_css = Servertool . respond_file_in_memory " style . css " " text / css " |
let ngrok_js = Servertool . respond_file_in_memory " . . / ngrok / ngrok . js " " application / javascript " |
let ngroklocal_html = Servertool . respond_file_in_memory " . . / ngrok / ngroklocal . html " " text / html " |
let server ngrok_mode port data = let callback ( conn : Server . conn ) req _body = let ( io_conn : Conduit_lwt_unix . flow ) , _ = conn in let cli = let hs = ( req : Request . t ) . headers in match Cohttp . Header . get hs " x - forwarded - for " with | Some adrs -> adrs | None -> Logdata . Client . source io_conn in... |
let ( ) = let port = ref 80 in let data_dir = ref " . . / out " in let log_file = ref None in let ngrok_mode = ref false in Arg . parse [ " -- port " , Arg . Int ( fun x -> port := x ) , " port ( default is 80 ) " ; " -- data - dir " , Arg . String ( fun s -> data_dir := s ) , " data dir ( default " . . \/ out " ) " \ ... |
let query_db pool ~ f ~ item = match % bind Caqti_async . Pool . use f pool with | Ok v -> return v | Error msg -> failwithf " Error getting % s from db , error : % s " item ( Caqti_error . show msg ) msg ( ) |
let main ~ archive_uri ~ state_hash ~ sequence_no ( ) = let archive_uri = Uri . of_string archive_uri in let logger = Logger . create ( ) in match Caqti_async . connect_pool archive_uri with | Error e -> [ % log fatal ] fatal ~ metadata [ : ( " error " , ` String ( Caqti_error . show e ) e ) e ] " Failed to create a Ca... |
let ( ) = Command ( . run ( let open Let_syntax in async ~ summary " : Swap bad balances for combined fee transfers " ( let % map archive_uri = Param . flag " -- archive - uri " ~ aliases [ : " archive - uri " ] ~ doc : " URI URI for connecting to the archive database ( e . g . , \ postgres ://$ USER @ localhost : 5432... |
module Scheduler = Sched_ws . Make ( struct let num_domains = 1 let is_affine = false end ) |
module Reagents = Reagents . Make ( Scheduler ) |
let id_str ( ) = sprintf " % d :% d " ( get_qid ( ) ) ( get_tid ( ) ) |
let main ( ) = printf " [ % s ] starting main \ n " ( id_str ( ) ) ; printf " **** Test 1 ****\ n " ; %! let ( ep1 , ep2 ) = mk_chan ( ) in let ( fp1 , fp2 ) = mk_chan ( ) in fork ( fun ( ) -> printf " [ % s ] % d \ n " %! ( id_str ( ) ) @@ run ( swap fp1 >>> swap ep1 ) 1 ) ; fork ( fun ( ) -> printf " [ % s ] % d \ n ... |
let ( ) = Scheduler . run main |
type rgb = { } |
type rgba = { } |
type rect = { } |
type big_rect = { } |
type matrix_part = { } |
type matrix = { } |
type color_transform_alpha = { } |
type function_decl = { } |
type function_decl2 = { } |
type try_block = { } |
type actions = action DynArray . t |
type header = { } |
type export = { } |
type import = { } |
type do_init_action = { } |
type sound = { } |
type start_sound = { } |
type sfs_bitmap = { } |
type shape_line_style = { } |
type shape_new_styles = { } |
type shape_change_style_record = { } |
type shape_curved_edge_record = { } |
type shape_straight_edge_record = { } |
type shape_records = { } |
type shape_with_style = { } |
type shape = { } |
type filter_gradient = { } |
type bitmap_jpg = { } |
type bitmap_data = { } |
type bitmap_lossless = { } |
type morph_shape = { } |
type cid_data = { } |
type text_glyph = { } |
type text_record = { } |
type text = { } |
type button_record = { } |
type button_action = { } |
type button2 = { } |
type remove_object = { } |
type edit_text_layout = { } |
type edit_text = { } |
type f9class = { } |
type files_attrib = { } |
type tag_data = } } } } |
type font_glyph_data = { } |
type font_layout_glyph_data = { } |
type font_kerning_data = { } |
type font_layout_data = { } |
type font2_data = { } |
type swf = header * tag list |
let __deflate = ref ( fun ( _ : unit IO . output ) output -> assert false ) false |
let __inflate = ref ( fun _ -> assert false ) false |
let __parser = ref ( fun _ -> assert false ) false |
let __printer = ref ( fun ( _ : unit IO . output ) output _ -> ( ) ) |
let error msg = raise ( Error msg ) msg |
let warnings = ref true |
let parse ( ch : IO . input ) input = |
let write ( ch : ' a IO . output ) output ( data : swf ) swf = |
let deflate ( ch : ' a IO . output ) output = |
let inflate ( ch : IO . input ) input = |
let full_parsing = ref true |
let force_as3_parsing = ref false |
let swf_version = ref 0 |
let id_count = ref 0 |
let tag_end = { tid = 0 ; textended = false ; tdata = TEnd } |
let sum f l = |
let const n = fun _ -> n |
let opt_len f = function |
let opt_flag flags fid f fparam = None else |
let opt f = function |
let rec make_flags = function |
let rec read_count n f arg = [ ] else |
let _nbits x = 0 else done ; ! nbits |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.